Solved

Need Clarification

Posted on 2004-08-11
15
207 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
Industry Leaders: 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

Technology Partners: 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!

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…

691 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