Why does java not allow multiple public classes in a java file ?
Answers were Sorted based on User's Feedback
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 |
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 |
Explain about global variables in Java?
Write java program to reverse string without using api?
Explain the term virtual machine?
Is break statement can be used as labels in java?
What do you mean by order of precedence and associativity?
in a constructor what happen if u call super and this in the same class? i know that it is not possible to call both in the same one? if we call what will happen?
In a my eclipse editor if i want to switch from jdk 1.4 to jdk 1.6 how to do that???? Initially i have jdk1.4
What is scope & storage allocation of global and extern variables? Explain with an example
How do I convert a string to an int in java?
Explain the private field modifier?
What are the rules for naming an array?
What modifiers are used with a top level class?