View Single Post
  #1 (permalink)  
Old 12-21-2007, 11:31 AM
bugger bugger is offline
Senior Member
 
Join Date: Nov 2007
Posts: 111
bugger is on a distinguished road
Private main method
I tried the following:
Code:
public class T { private static void main(String[] str) { System.out.println("test"); } }
It does not give me any errors at compile time (I am using Eclipse 3.3). When I try to run it, it says "Main method not public". Makes sense.

But I would like to know, why main method should always be public. This method is not called by other classes directly.
Reply With Quote
Sponsored Links