This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

why public for main


hello friends out there,
Iam a newbie in java, I just have a simple and a very
annoying ( at least to me ) question. Why do we use the keyword
public for the main method ?
eg.
public static void main(String arg[])



Actually the problem is that, it works even if I don't use public.
In fact it works if I use private like
private static void main(String arg[])
only removing static does not work.
Thus,
all the following works,



public static void main(String arg[])


private static void main(String arg[])

static void main(String arg[])


but the following does not work,



void main(String arg[])


################ WHY #####################


please help


Amroz


Siddiqui Amroz Kamal _______________________________________________________________________ Odomos - the only mosquito protection outside 4 walls - Click here to know more! http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htm&&odomos&&wn


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]