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 the difference between Grid and Gridbaglayout?

798


What is downcasting?

795


What is oop principle in java?

746


What is the importance of hashcode() and equals() methods?

791


Does substring start with 0?

748


What is super constructor?

745


What is the default execution method in java?

870


Can we create our own wrapper class in java?

745


What is bigger kb or mb?

792


What is break and continue statement?

794


2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?

2051


What is meant by final class?

777


Which browsers work with java?

822


What is function overriding and overloading in java?

807


What is time complexity algorithm?

786