Solved

Need Clarification

Posted on 2004-08-11
15
204 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

948 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now