Skip to content

Instantly share code, notes, and snippets.

@AdelinGhanaem
Created August 7, 2019 13:29
Show Gist options
  • Select an option

  • Save AdelinGhanaem/3b94b575628e6881889919a037f86f0e to your computer and use it in GitHub Desktop.

Select an option

Save AdelinGhanaem/3b94b575628e6881889919a037f86f0e to your computer and use it in GitHub Desktop.
public class Friend {
String name;
String midName;
Date dateOfBirth;
// this class has on defautl constructor, as you have not defined any construcotr;
// You can create objects of type Friend like this Friend f = new Friend();
}
public class FriendWithConstructor {
String name;
String midName;
Date dateOfBirth;
//construcotr 1
public FriendWithConstructor(String name) {
}
//construcotr 2
public FriendWithConstructor(String name, String midName) {
}
//construcotr 3
public FriendWithConstructor(int someNumber, int someOther Number) {
}
// this class has on defautl constructor, as you have not defined any construcotr;
// You CAN'T create objects of type Friend like this Friend f = new Friend();)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment