?
Solved

Need Clarification

Posted on 2004-08-11
15
Medium Priority
?
208 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
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 100 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 600 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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

770 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