<a href="http://eathumblepie.blogspot.com" target="_blank" rel="nofollow">http://eathumblepie.blogspot.com</a>
Originally posted by sandhi mridul:
Hi Hamsagayathri,
If you take the
It behaves like any method
with the name "main" which is "static" and the return type is "void" takes "String array" as argument.
So it will compile without any problem just like any other method.
But if you try to call any other method from this main method specially whih is out of the scope of the default modifier then it will throw exception as the modifier here is "default".
That is why it shld be public and can also be final.
Hope this help
Sandhi
Originally posted by sandhi mridul:
Hi Hamsagayathri,
If you take the
It behaves like any method
with the name "main" which is "static" and the return type is "void" takes "String array" as argument.
So it will compile without any problem just like any other method.
But if you try to call any other method from this main method specially whih is out of the scope of the default modifier then it will throw exception as the modifier here is "default".
That is why it shld be public and can also be final.
Hope this help
Sandhi
Originally posted by sandhi mridul:
Hi Hamsagayathri,
If you take the
It behaves like any method
with the name "main" which is "static" and the return type is "void" takes "String array" as argument.
So it will compile without any problem just like any other method.
But if you try to call any other method from this main method specially whih is out of the scope of the default modifier then it will throw exception as the modifier here is "default".
That is why it shld be public and can also be final.
Hope this help
Sandhi
Originally posted by Hamsagayathri Palanisamy:
why the main() method is called first?
Originally posted by Hamsagayathri Palanisamy:
For sample i have tried following code.Imhavent call any method but, still it shows error while running program..
Originally posted by sandhi mridul:
Hi Hamsagayathri,
If you take the
It behaves like any method
with the name "main" which is "static" and the return type is "void" takes "String array" as argument.
So it will compile without any problem just like any other method.
But if you try to call any other method from this main method specially whih is out of the scope of the default modifier then it will throw exception as the modifier here is "default".
That is why it shld be public and can also be final.
Hope this help
Sandhi
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|