19th Mar 2019, 2:40 PM
Iftakher Hossain
Iftakher Hossain - avatar
5 Réponses
+ 5
You missed two closing braces for class Person and Teacher. '@override' is supposed to be '@Override'. In main, there is no attribute 'quality' for object of type Teacher. Please refer to the fix I provided: public class Person{ String name; int age; void display(){ System.out.println("Name is: " +name); System.out.println("Age is : " +age); } } public class Teacher extends Person { String qualification; @Override void display(){ System.out.println("Name is: " +name) ; System.out.println("Age is : "+age); System.out.println("Qualification is :" +qualification) ; } } public class Main{ public static void main(String[] args) { Teacher t1 = new Teacher(); t1.name = "Rock"; t1.age = 27; t1.qualification = "BSc"; t1.display(); Person p1 = new Person() ; p1.name = "Hamim"; p1.age = 7; p1.display(); } }
19th Mar 2019, 2:51 PM
Hatsy Rei
Hatsy Rei - avatar
19th Mar 2019, 2:55 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Denise Roßberg Same changes, basically. :>
19th Mar 2019, 2:58 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Thanks all.
19th Mar 2019, 3:03 PM
Iftakher Hossain
Iftakher Hossain - avatar
+ 2
what's wrong?
19th Mar 2019, 2:43 PM
Iftakher Hossain
Iftakher Hossain - avatar