Creating classes is easy and fun. Let's feel like the creators of a virtual universe and create Man and Woman classes. They must be declared inside the Solution class and be public static. They need to have "name", "age" and "address" fields. We also need to declare constructors with all possible parameters. Then we will be able to use them to create specific objects.
Man and woman
You must be signed in to leave a comment
Emmanuel Tovar Ruiz
6 January, 02:29
My code seemed right, but it failed with a message: Be sure you create two Man objects I needed to download the correct solution and it was a minor mistake. I used the toString() method directly instead of using System.out.println(man/woman); But it is really disorienting that message. The problem isn't related to the objects. Dammit!
6 October 2020, 21:16
Attention! You have to make 2 objects of each type. It means: 2 Man objects and 2 Woman objects. And each object has to use the constructor with three variables..
Karas Java Developer
31 August 2020, 19:02
Make sure you create the objects USING the contructors.
2 May 2020, 15:36
Can you help me what I am doing wrong?
1 February 2020, 19:43
Thank you for teaching me how to use the toString() method.
26 April 2021, 04:51
13 December 2019, 18:18
Attention! Note that "" the quotes have a space between them. That's super unclear. It looked like empty strings.
20 October 2019, 00:38
Great lesson to bring all the Level 5 ideas together!
11 June 2019, 15:42
I have a question. If we can create our own String representation method to return a string for an object,i.e, getObjecttoString(); then what is so special about toString() that we have to override it then implement it similar as the above mentioned method to return the String. I mean as far as I can see there is no special reason to use toString() as it functions the same. So what makes toString() special and why should it be used?
2 October 2018, 05:10
can anyone tell me where am i doing wrong??
2 October 2018, 06:20
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.