public class Solution {
String name;
int age;
String address;
public static void main(String[] args) {
Man man1 = new Man("Beni", 25 ,"Szhely");
Man man2 = new Man("Mark", 26 , "Szhely");
Woman woman1 = new Woman("Imola", 26 , "Gencs");
Woman woman2 = new Woman("Kitti", 24, "Gencs");
System.out.println(man1.name + man1.age + man1.address);
System.out.println(man2.name + man2.age + man2.address);
System.out.println(woman1.name + woman1.age + woman1.address);
System.out.println(woman2.name + woman2.age + woman2.address);//write your code here//write your code here
}
public static class Man extends Solution {
public Man (String name, int age, String address){
super(name, age, address);
}
}
public static class Woman extends Solution {
public Woman (String name, int age, String address){
super(name, age, address);
}
}
//write your code here
}
why cant i use the super() keyword here?
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
18 March 2019, 20:38solution
because there is no Solution constructor that uses those parameters. You would need code in the solution namespace like this for that to work:
+2
Bazsó Benjámin
18 March 2019, 20:45
ah i see thank you :)
still it wont validate for me
i get the error msg: The main method should display the created objects on the screen in the specified format. Be sure that you create 2 Man objects.
im sure I have 2 man objects already?
EDIT: NVM i got it, missed the spaces... +1
Guadalupe Gagnon
18 March 2019, 20:54
=P
0