• Post Reply Bookmark Topic Watch Topic
  • New Topic

main is private , but the code compiles and run why  RSS feed

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello , Why this code compiles and execute , the main method is private here

class Demo
{
private static void main ( String ka [ ] )
{
System.out.println ( "faisal usmani" );
}
}

Thanx in advance
 
Bartender
Posts: 9443
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you certain your code works?

 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Ess:
Are you certain your code works?



I'm sure it worked in earlier versions of Java. It was a JVM bug, although a minor one...
 
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
...I'm sure it worked in earlier versions of Java. It was a JVM bug, although a minor one...

Yes, prior to Java 1.4, main was not required to be public.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!