aspose file tools*
The moose likes Beginning Java and the fly likes main is private , but the code compiles and run  why Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main is private , but the code compiles and run  why " Watch "main is private , but the code compiles and run  why " New topic
Author

main is private , but the code compiles and run why

faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
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
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

Are you certain your code works?



"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: main is private , but the code compiles and run why