File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes compile time errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "compile time errors" Watch "compile time errors" New topic

compile time errors

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
public class MyOuter
public static void main(String args[])
public class MyInner

Hi All,
the above program is compiling fine even if we have more than one public class file?how come its possible?should compiler must not show compile time errors?
anybody please provide the solution

Jas Oberai
Ranch Hand

Joined: Jan 16, 2005
Posts: 231
The name of the class itself suggests one is outer and other is inner class.You can't have two top-level classes with public as the access modifier,but there's no problem as shown with your code...and so it compiles fine

SCJP 1.4 (88%)<br />SCWCD 1.4 (88%)
Don't get me started about those stupid light bulbs.
subject: compile time errors