Code:
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
if (args[2] == "help"){
System.out.println("help");
}
}
}
}
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
if (args[2] == "help"){
System.out.println("help");
}
}
}
}
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
if (args[2].equals("help")) {
System.out.println("help");
}
}
}
}
public class Echo {
public static void main (String[] args) {
for (String s: args) {
System.out.println(s);
if (args[2].equals("help")) {
System.out.println("help");
}
}
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Echo.main(Echo.java:5)
Comment