Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Why does java not allow multiple public classes in a java file ?

Answers were Sorted based on User's Feedback



Why does java not allow multiple public classes in a java file ?..

Answer / 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

Why does java not allow multiple public classes in a java file ?..

Answer / rahul

java does not support multiple public classes because of there are only one main method to define......and we can not have multiple main methods in a same class....and we know that java code will always save as the name of class name in which main method are define......

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Core Java Interview Questions

what is request processor?

1 Answers   Virtusa,


Why can't we make a class private in java?

0 Answers  


What is hypertext?

1 Answers  


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

0 Answers  


What is actual difference between statement,prepared statement and callable statement and when we have to use it? pls post a answer with code and clear explanation. thanks

2 Answers  


Can we modify the throws clause of the superclass method while overriding it in the subclass?

0 Answers  


what is the full form of java

3 Answers  


What is hashing principle in java?

0 Answers  


how can you take care of mutual exclusion using java threads? : Java thread

0 Answers  


What is difference between classpath and path variables in java?

0 Answers  


What is udp in java?

0 Answers  


What modifiers may be used with an inner class that is a member of an outer class in java programming?

0 Answers  


Categories