+ 3
Hybrid inheritance in java
Is this code for hybrid inheritance in java valid. I am getting the desired output. OUTPUT: class C class D class D (This program will not run properly on sololearn) https://code.sololearn.com/cwIu3sWs251u/?ref=app
5 odpowiedzi
+ 4
You can call the class anything. SoloLearn expects to find main in the first class it sees so putting class C after class D would let your code run here.
https://code.sololearn.com/ceJ2g7J23qWM
+ 2
thanks
+ 1
seems correct on first glance. why did you put the main function in class D? just put it in an appropriatly named class and the code should run on sololearn
+ 1
appropriately named class means?
because on my compiler this code works.
+ 1
when you create a code in sololearn the class which contains the main methods is called Program and i assume the file is also called Program. since you can‘t change the filename on their server i think your main method has to be in a class called Program, and i dont think this class Program should implement from A and B but rather use D. its just one of the quirks of the sololearn enviroment