static void main( String args[]) with out public . what are the implications
of this because when i compile using this it is comping fine and there are
no run time errors too. Can any one help me.
thanks
kal
05-24-2000, 10:58 AM
Paul Clapham
Re: Main method
You can compile and run? Then there's no problem, right?
kal <k_paladugu@hotmail.com> wrote in message
news:392aac18$1@news.devx.com...
>
> Is it correct way of defining the main method as
>
> static void main( String args[]) with out public . what are the
implications
> of this because when i compile using this it is comping fine and there are
> no run time errors too. Can any one help me.
>
> thanks
> kal
05-28-2000, 10:41 PM
Karnos
Re: Main method
When you don't explicitly declare something as public, it's declared by default
as package accessible. This means that only objects from classes within
the same package as the method/attribute can see it. With a main() method,
this isn't usually a problem, as calling main() methods from existing objects
is a rarity. But you should always type "public" if that's what you want.
There's no reason not to, unless those extra six key strokes will cause
your CTS to manifest.
"kal" <k_paladugu@hotmail.com> wrote:
>
>Is it correct way of defining the main method as
>
>static void main( String args[]) with out public . what are the implications
>of this because when i compile using this it is comping fine and there are
>no run time errors too. Can any one help me.
>
>thanks
>kal