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

What is the multi-catch block in java?

539


What does localhost mean?

502


What is a treemap in java?

545


What is math exp in java?

550


What is the use of pattern in java?

516






Can private class be inherited in java?

555


can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread

542


Can You Have Virtual Functions In Java?

590


Explain java thread life cycle.

585


Can we extend singleton class in java?

552


What is variable in java?

529


How do you check if an arraylist is not empty?

579


Does treeset allow null in java?

520


What is a finally block?

568


What technique is carried out to find out if a particular string is empty?

579