| Author |
query
|
Kartik Mahadevan
Ranch Hand
Joined: Feb 16, 2005
Posts: 45
|
|
|
Suppose I have declared 2 classes as public in the same file then compilation does not take place ? Why?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Hi, Welcome to JavaRanch! The simplest answer is because that's the rule: there can only be one public top-level class or interface per file. If you need an explanation: it's just because it makes it easier for the compiler to find the source for a given class if it's in a file with the same name as the class.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Kartik Mahadevan
Ranch Hand
Joined: Feb 16, 2005
Posts: 45
|
|
|
Thank U very much
|
 |
 |
|
|
subject: query
|
|
|