Compilation source sous JDK 1.5 :
Source: réalisé le 29/01/2003 sous JDK 1.3
public class Prog2{
public static void main(String[] args){
System.out.println("il y a "+ args.length +"arguments");
System.out.println("arguments 1"+ args[0]);
System.out.println("arguments 2"+ args[1]);
}
}
Cmd (Windows ) et shell (Linux)
C:\Documents and Settings\Salut\Bureau\Cours_Java\29-01-2003>javac Prog2.java
C:\Documents and Settings\Salut\Bureau\Cours_Java\29-01-2003>java Prog2
il y a 0arguments
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Prog2.main(Prog2.java:13)
C:\Documents and Settings\Salut\Bureau\Cnam2003\29-01-2003>
