Why does java not allow multiple public classes in a java file ?

Answer Posted / rahul

java does not support multiple public classes because of there are only one main method to define......and we can not have multiple main methods in a same class....and we know that java code will always save as the name of class name in which main method are define......

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is anonymous class in java?

538


What is meant by string is immutable?

515


Can we store variables in local blocks?

780


What is array command?

551


What is the difference between post and put?

533






Explain importance of finally block in java?

574


What is the base class for error and exception?

547


Difference between serialization and deserialization in java?

646


Explain abstract class in java?

552


What is data structure in java?

525


What is the difference between the boolean & operator and the && operator in java programming?

560


What is the difference between declaration and definition in java?

513


What is meant by method overriding?

538


What are the changes in java.io in java 8 ?

545


What is sorting in java?

524