Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Need Clarification

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
lordiano
Asked:
lordiano
  • 6
  • 4
  • 3
  • +1
3 Solutions
 
JavatmCommented:
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
 
lordianoAuthor Commented:
Is there any difference between String args[] and String[] s
aint they both just gonna be pointer object to string array?
0
 
JavatmCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
JavatmCommented:
> aint they both just gonna be pointer object to string array?

Yes thats correct ! both are array strings.
0
 
objectsCommented:
both are the same
0
 
funnyveryfunnyCommented:
public static void main(String[] args) ==> it's a predefined method signature.
0
 
lordianoAuthor Commented:
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
 
JavatmCommented:
I think you mean this :

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

Yes you can . . .
0
 
JavatmCommented:

Or this :

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

Yes you still can . . .
0
 
lordianoAuthor Commented:
so it does not make any difference then?
whether i have (String s[]) or (String[] s)
0
 
objectsCommented:
no
0
 
lordianoAuthor Commented:
thank you for everyone that helped
0
 
objectsCommented:
0
 
funnyveryfunnyCommented:
:-)
0
 
JavatmCommented:
=-) Always Glad 2 Help . . .

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 6
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now