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
What does java se mean?
What is function declaration?
Can we override data members in java?
What is difference between == equals () and compareto () method?
What is use of set in java?
What is the difference between abstraction and encapsulation?
What’s the difference between the methods sleep() and wait()?
What is factor r?
Can we store variables in local blocks?
Is a copy constructor?
What are the two types of java?
What is static variable with example?
Which number is denoted by leading zero in java?
Is there any case when finally will not be executed?
What is Gang of four design patterns