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


Please Help Members By Posting Answers For Below Questions

How to check if a list is sorted in java?

582


What is difference between add() and addelement() in vector?

1058


What is the difference between preemptive scheduling and time slicing in java programming?

527


Can we create more than one object singleton class?

571


What is variable explain with example?

566






What is default switch case? Give example.

572


What is compiler and what its output.

628


Can we sort arraylist in java?

555


Explain heap sort?

696


Explain the pointers in Java?

590


what is function overloading in java?

690


What is the difference between equals() and == in java?

519


What is binary search in java?

553


What is the length of a string?

515


What does system out println () do?

551