0
What's the problem??
4 Respuestas
+ 2
First of all I added 'toString' method that is use to print different attributes of a class.
Secondly I suggest you to learn more concepts of oop like encapsulation(getters/setter) ,inheritance its uses that help you in better understanding.
description of tostring method
https://www.sololearn.com/Discuss/2242260/?ref=app
Here is your code working fine now
https://code.sololearn.com/caEs0acSUP5T/?ref=app
0
Muhammad Bilal thank you, I will need to do some more research...
0
Just wanted to add few points.
▪ When you inherit a class, you inherit everything that is either public, protected or members with no access modifier(default).
▪ You cannot override fields, they are hidden by child class.
▪ You can override non-static methods.
▪ Learn and practice constructors, getter and setter methods.
0
Avinesh 👍🏻👍🏻👍🏻