Created
August 7, 2019 13:29
-
-
Save AdelinGhanaem/3b94b575628e6881889919a037f86f0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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