+ 2
Java class excecutions
My third class is not excecuting so requesting assistance.....Do we need a command so that it will move to next class...THANKS IN ADVANCE https://code.sololearn.com/cfmIqO83J2V4/?ref=app
5 Réponses
+ 3
Not sure what you are trying to do.
Points to remember-
▪ A Java file cannot have more than 1 public class.
▪ You can overload a main method but cannot override it.
Change main1 to main in 3rd class and it should work on the playground.
+ 2
I think there can be just one top level class per java file... So execution of main method in MyClass1 is discarted...
+ 1
Change main1 to just main. Avinesh is correct in that a normal java file can't have more than one class, but this is sololearn so they allow it.
"main" tells the program where to start executing the program, that's why main1 doesn't work.
0
Thanks Avinesh, Odyel,Jesuś roberto
I was just trying if Counter would accept a new entry from multiple classes but of i put main the 3 rd class was not executing so i was confused
THANKS FOR ASSISTANCE 😄
0
So what do we do add another class to a same program.. Import it after creating a seprate file???? And is a way to add something like a sub category of main??
Thank u for assisting.... 😊😊