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
Why packages are used?
What is the main purpose of java?
Can one thread block the other thread?
Is ++ operator is thread safe in java?
What is meant by final class?
What is java ceil?
When to use runnable interface vs thread class in java?
What is the synchronized method modifier?
Can an interface implement another interface?
How does a for loop work?
What means public static?
What is a method vs function?
What is __ init __ functions?
Write a program to calculate factorial in java?
What is an argument java?