Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "compile time errors" Watch "compile time errors" New topic
Author

compile time errors

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
public class MyOuter
{
public static void main(String args[])
{
System.out.println("hi");
}
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

Thanks
venkat
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%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile time errors
 
Similar Threads
servlet unable to retrieve the package why??
Inner class compile time errors
whts the out put
Conditional display of DisplayTable of DisplayTag
compile time errors