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
Can a class be private?
What is the difference between a local variable and an instance variable?
Can we have multiple catch block for a try block?
What are static blocks and static initalizers in java ?
Can we compare two strings in java?
Which class represents the socket that both the client and server use to communicate with each other?
What is a substring of a string?
What is the java idl system?
What is variable and its types?
What is meant by anonymous class?
What is meant by class and object in java?
What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?
Explain about field hiding in java?
What is vector?
What is difference between local variable and global variable?