Why does java not allow multiple public classes in a java file ?
Answer Posted / sushila sonare
suppose in java file so many classes, interfaces, abstract
classes and enumerations are there. we can keep only one of
them as a public because its shown a container and this
container we are keeping all things in our java file.
if we kept public for more then one class then all are that
classes qualified as a container or we are called it
execution unit. again compiler get confuse which container
classes has to kept. So avoiding this confusion multiple
public classes are not allowed in java.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain heap sort?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
can java object be locked down for exclusive use by a given thread? : Java thread
Compare java and python.
What is the difference between Array and Hash Table?
What is the difference between array and array list in java?
Why is string builder not thread safe?
Does java map allow duplicates?
What is the difference between inner class and nested class?
Is java a digit method?
Can You Have Virtual Functions In Java?
What is gui programming?
What is java life cycle?
Difference between string, stringbuffer and stringbuilder?
What are the common uses of "this" keyword in java ?