Solved

Need Clarification

Posted on 2004-08-11
15
206 Views
Last Modified: 2010-03-31
What is the difference between :
public static void main(String args[])
and
static public void main(String[] s)

Why we are not using String args[] in the static public void main as well?
0
Comment
Question by:lordiano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +1
15 Comments
 
LVL 15

Expert Comment

by:Javatm
ID: 11779339
Technically speaking > 
public static void main(String args[])

Is the normal way of declaring a public access main method and its is the normal thing than  :
static public void main(String[] s)

Hope that helps . . .
Javatm
0
 

Author Comment

by:lordiano
ID: 11779346
Is there any difference between String args[] and String[] s
aint they both just gonna be pointer object to string array?
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11779387
Here are the meanings : public static void main(String args[])

public :
This method can be accessed from outside the class

static :
This method does not require that an object of the class exists. static methods are sort of like global methods,
they are always available, but you need to use the class name to get them

void : no return value

main(String args[]) :
main() will be passed an array of Strings correspondig to any command line parameter values.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:Javatm
ID: 11779396
> aint they both just gonna be pointer object to string array?

Yes thats correct ! both are array strings.
0
 
LVL 92

Expert Comment

by:objects
ID: 11779454
both are the same
0
 
LVL 4

Assisted Solution

by:funnyveryfunny
funnyveryfunny earned 25 total points
ID: 11779762
public static void main(String[] args) ==> it's a predefined method signature.
0
 

Author Comment

by:lordiano
ID: 11779963
Thanks for reply,
I understand the public, static and void..etc
but what i dont get is
can we use

static public void main(String s[])

instead of

static public void main(String[] s)

I am increasing the point because its more questions that i originally posted
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11779969
I think you mean this :

public static void main(String args[]) and static public void main(String[] s) ?

Yes you can . . .
0
 
LVL 15

Accepted Solution

by:
Javatm earned 150 total points
ID: 11779972

Or this :

static public void main(String s[]) instead of static public void main(String[] s) ?

Yes you still can . . .
0
 

Author Comment

by:lordiano
ID: 11779983
so it does not make any difference then?
whether i have (String s[]) or (String[] s)
0
 
LVL 92

Assisted Solution

by:objects
objects earned 25 total points
ID: 11780005
no
0
 

Author Comment

by:lordiano
ID: 11780015
thank you for everyone that helped
0
 
LVL 92

Expert Comment

by:objects
ID: 11780078
0
 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 11783770
:-)
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11788485
=-) Always Glad 2 Help . . .

http://freewebs.com/cube-j
Friend : Javatm
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question