+ 1

public class in java

I know that we can't run a java program without a public class still why we can run a program without public class in sololearn compiler?

26th Jun 2018, 1:12 AM
harshit
harshit - avatar
3 Respuestas
+ 1
We can run a java program without public class. If we want to we can have atmost one public class in our source code. In that case name of the program must be same as name of the public class.
26th Jun 2018, 3:49 AM
Nikhil Sharma
Nikhil Sharma - avatar
0
It is software and public keywords is predefined in sololearn
26th Jun 2018, 4:41 AM
mantu kumar
mantu kumar - avatar
0
We declare public class for accessing means any one can access so thats why we declare public class
26th Jun 2018, 4:43 AM
mantu kumar
mantu kumar - avatar