aspose file tools*
The moose likes Java in General and the fly likes main(String arr[]) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "main(String arr[])" Watch "main(String arr[])" New topic
Author

main(String arr[])

chowdaryv
Greenhorn

Joined: Jul 05, 2000
Posts: 8
iam able to call main(String arr[]) from command prompt with having private access modifier.


chow.
Herbert Maosa
Ranch Hand

Joined: May 03, 2000
Posts: 289
I dont quite understand the question, I think.But if it is to express the fact that you dont get any errors with main declared as "private", then let it be known to you that this is an inconsistency in the declaration of the method called "main", that Sun admits and documented.It does not agree with the Java Language Specification which stipulates that main has to be declared as public static and void.So in general, the intended behavior was for the compiler to complain if main is defined differently from public static void, but somehow it managed to sneak through and one can successfully make it private and all will be oky.For the sake of conformity to the language specification though, let us consider main as public static void.
Herbert
ricky gonzalez
Ranch Hand

Joined: Jun 30, 2000
Posts: 167
I think "private static void main(String [] argv)" is not going to get compiled. Can you post the source code?
Also, static void main(String [] argv) will get compiled and run successfully. I guess all fields are by default public.
Thanks.
RAMESHDESHPANDE
Greenhorn

Joined: Jan 31, 2001
Posts: 2
Originally posted by chowdaryv:
iam able to call main(String arr[]) from command prompt with having private access modifier.

RAMESHDESHPANDE
Greenhorn

Joined: Jan 31, 2001
Posts: 2
Originally posted by chowdaryv:
iam able to call main(String arr[]) from command prompt with having private access modifier.

PLEASE SEND ME THE CODE
BYE,
RAM_DESH@USA.NET
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
It does work. Just try it.
Sridhar Katakam
Greenhorn

Joined: Jan 28, 2001
Posts: 8

Default is 'package' not 'public'
~Sri~
Originally posted by ricky gonzalez:
I think "private static void main(String [] argv)" is not going to get compiled. Can you post the source code?
Also, static void main(String [] argv) will get compiled and run successfully. I guess all fields are by default public.
Thanks.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: main(String arr[])