I want to display firstname to parentfirst and lastname to parentsecond in my child class. I have one error. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to display firstname to parentfirst and lastname to parentsecond in my child class. I have one error.

Two parent class. https://code.sololearn.com/cgA133UZ0Nle/?ref=app

11th Jun 2020, 7:05 AM
Malick Diagne
Malick Diagne - avatar
2 Answers
+ 7
In Java, A class can extend only one class. A work around would be to use interfaces. On line 2 , `string` should be `String`.
11th Jun 2020, 7:09 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
Malick Diagne Multiple Inheritance (extends more than one class) is not allow in Java so better to use interface. Btw string will be String. You can impliment multiple interface but can't extends multiple classes.
11th Jun 2020, 7:14 AM
A͢J
A͢J - avatar