-
Main method
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
-
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
-
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks