Nov 30

This post is also available in: German

While program execution parameters can be passed which the program is picking up. Let’s take – as usual – an example;

Program Test has the following code:

public class Test{

public static void main(String args[]) {

for (String s:args)

System.out.println(s);

}

}

Starting the program with

java Test 1 2 3

leads to the Output:

1
2
3

String args [ ] is overtaking the passed values.

Declaration of main public static void main(String args[]) is not the one and only valid one. Others may be as well suitable, e.g.

public static void main(String … x)

static public main (String [ ] y)

static public void main (String [ ] y)

  • Print
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • Add to favorites
  • RSS
  • Blogosphere
  • email
  • PDF
  • Wikio
  • Technorati
  • Digg
  • DZone

Leave a Reply

preload preload preload
http://www.wikio.de Blog Top Liste - by TopBlogs.de Blogverzeichnis - Blog Verzeichnis bloggerei.de Bloggeramt.de Software
Webbhotell Top Blogs