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
How to print an arraylist in java?
Explain features of interfaces in java?
Can list be final in java?
Can static methods access instance variables in java?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?
What are the ways in which a thread can enter the waiting state?
What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?
What is a parent class in java?
What is arraylist e in java?
What is the Difference between Final Class && Abstract Class?
What is 16 bits called?
How many types of equations are there?
What is an abstract method in java programming?
What kind of variables a class can consist of?