+ 5
How to use EXTENDS Keyword in Java?
Hello guys, If I have these classes: Student class, Undergraduate class, Postgraduate class, Address class, Course class, and Faculty class What are the categories that I should inherit from the others? With the keyword extends, I wish you could write it for me as: Student extends Course like this...
12 Respuestas
+ 6
Lisa John , this is explained in the java tutorial in the oop section. so please be patient until you have a bit more experience.
and please remember, that we are NOT writing a code for you. but if you put your attempt in playground and link it here, you will get help from the community
thanks for your understanding!
+ 2
I can't arrange it if you can arrange it for me please.
Zainul Khan
+ 2
Thx Lily Mea 💜💜
+ 1
Lothar
I am learning programming at the university and I downloaded this application to get help from the community members who understand more than me so I just hope you can help me by giving me simple hints and I am now working on my project and I don’t want to mistake it or spend more time writing it please understand me I just need pencil tips to get I understand it because I know what the relationship is between them, please help me and thank you
+ 1
just hint ,cause i dont know how these classes work for ur code
extends keyword expects a base-derived class relationship, which mean one class(derived) extends other class'(base) functionalities and properties..you can find out by asking yourself if the derived class is also same as it's base class but with additional functionalities or properties..if yes, then you can inherit from that base class
+ 1
ok Abdulrahman Alniema Thank u
+ 1
Undergraduate extends Student.
Postgraduate extends Students.
Student extends Course.
Student extends Address.
+ 1
Java Developer
Student shouldn't extend Course or Address because it is a (has) relationship, a Student has Address and Course in this case you should composition instead, not inheritance.
Have a good day :)
0
Start inheriting from the lowest level to the uppermost level
0
You inherit a class A from another B if it has an is relationship with B => (A is B), like a Cat is an Animal and so ..
0
Lisa John u r welcome
0
Your wellcome