jaspreet manchinda wrote:Hello Everyone,
can anyone please tell me what is difference between
1.public static void main ();
2.public static void main(String args []);
3.public static void main (String... args);
i know its kind of noob question but i am little confused with it
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Same as 2. Only syntax is different. Instead of String array, here there's usage of var-args.
jaspreet manchinda wrote:Quote:
Same as 2. Only syntax is different. Instead of String array, here there's usage of var-args.
thank you for your reply but when to use main without argument and when to use wit var-args
Vinod Vijay Nair
jaspreet manchinda wrote:Hello Everyone,
can anyone please tell me what is difference between
1.public static void main ();
2.public static void main(String args []);
3.public static void main (String... args);
i know its kind of noob question but i am little confused with it
Thanks
-Aj
http://www.lifesbizzare.blogspot.com || OCJP:81%
Vishal Hegde wrote:
At compile time this code will work fine
But at run time you will get an Exception.
Remember Exceptions come during Runtime
Vinod Vijay Nair
Vinod Vijay wrote:
Vishal Hegde wrote:
At compile time this code will work fine
But at run time you will get an Exception.
Remember Exceptions come during Runtime
Ofcourse, it will compile because no syntax or Java rule violations. But will not run because the interpretor could not locate standard main().
http://www.lifesbizzare.blogspot.com || OCJP:81%
Vishal Hegde wrote:
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Vishal Hegde wrote:
Vinod Vijay wrote:
Vishal Hegde wrote:
At compile time this code will work fine
But at run time you will get an Exception.
Remember Exceptions come during Runtime
Ofcourse, it will compile because no syntax or Java rule violations. But will not run because the interpretor could not locate standard main().
Thats what I was conveying
Vinod Vijay Nair