-5

being new to java programming and a novice learner, specifically looking at the command

public static void main(String[] args)

what does public static void mean ? and what are terms like args meant to do ?

TheLostMind
  • 35,966
  • 12
  • 68
  • 104
  • Since you're new to Java, you're better off reading some Java tutorials or text first. I'm sure every beginner's text covers this. – Swapnil Aug 14 '14 at 03:40
  • Welcome to SO. Just FYI, elementary questions that can be answered with some research on your own tend to not be well received here. If you are just starting out with Java, try a basic tutorial like [The Java Tutorials](http://docs.oracle.com/javase/tutorial/index.html). Come back when you have more specific code questions and you will find a better reception. Best of luck. – paisanco Aug 14 '14 at 03:43
  • You don't need to concern yourself with that line yet, for now think of it as the entry point, magic code that has to be there for the program to work. You'll learn what it means once you've mastered the basics. – Boop Aug 14 '14 at 03:44
  • At those pointing to Google and the Java Tutorials - the basic idea of most material you find is "It's magic, you'll figure it out later." – jdphenix Aug 14 '14 at 03:48
  • BTW it should be `String[] args` not `string[] args`. Your code won't compile with `string`. Edited your question. :) – TheLostMind Aug 14 '14 at 03:48

1 Answers1

11

public --> access specifier. Any other class can access this method.

static --> The method is bound to the class, not to an instance of the class.

void --> return type. The method doesn't return anything.

main(String[] args) --> method name is main(). It takes an array of String 's as argument. The String[] args are command line arguments.

Note : The main() method defined above is the entry point of a program, if you change the signature, then your program might not run.

TheLostMind
  • 35,966
  • 12
  • 68
  • 104