Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
|
info:java:einrueck [2010/12/07 20:59] admin |
info:java:einrueck [2010/12/07 21:05] (aktuell) admin |
||
|---|---|---|---|
| Zeile 56: | Zeile 56: | ||
| public static void main(String[] args){ | public static void main(String[] args){ | ||
| System.out.print("Hallo "); | System.out.print("Hallo "); | ||
| - | if(args.length>0) | + | if(args.length<1) |
| - | System.out.println(args[0]); | + | |
| - | else | + | |
| System.out.println("Leute"); | System.out.println("Leute"); | ||
| - | if(args[0].equals("Hans")){ | ||
| - | System.out.println("Mein Meister!"); | ||
| - | System.out.println("Endlich bist du da."); | ||
| - | } | ||
| else{ | else{ | ||
| - | System.out.println("Ich kenne dich nicht."); | + | System.out.println(args[0]); |
| - | System.out.println("Geh fort!"); | + | if(args[0].equals("Hans")){ |
| + | System.out.println("Mein Meister!"); | ||
| + | System.out.println("Endlich bist du da."); | ||
| + | } | ||
| + | else{ | ||
| + | System.out.println("Ich kenne dich nicht."); | ||
| + | System.out.println("Geh fort!"); | ||
| + | } | ||
| } | } | ||
| } | } | ||
| Zeile 80: | Zeile 81: | ||
| public static void main(String[] args){ | public static void main(String[] args){ | ||
| System.out.print("Hallo "); | System.out.print("Hallo "); | ||
| - | if(args.length>0) System.out.println(args[0]); | + | if(args.length<1) System.out.println("Leute"); |
| - | else System.out.println("Leute"); | + | else{ |
| - | if(args[0].equals("Hans")){ | + | System.out.println(args[0]); |
| - | System.out.println("Mein Meister!"); | + | if(args[0].equals("Hans")){ |
| - | System.out.println("Endlich bist du da."); | + | System.out.println("Mein Meister!"); |
| - | } else{ | + | System.out.println("Endlich bist du da."); |
| - | System.out.println("Ich kenne dich nicht."); | + | } else{ |
| - | System.out.println("Geh fort!"); | + | System.out.println("Ich kenne dich nicht."); |
| + | System.out.println("Geh fort!"); | ||
| + | } | ||
| } | } | ||
| } | } | ||