The VBer
Feb 25th, 2010, 03:33 PM
Okay, so after programming with VB for a year or two, i figured it's about time i learn another language. One of the beginner examples deals with arguments. Here's the code:
class BlankFiller {
public static void main(String[] args) {
System.out.println("The " + args[0]
+ " " + args[1] + " fox "
+ "jumped over the "
+ args[2] + " dog."
);
}
}
What the program should do is fill in the blanks (args).
In the example i'm using, it says to add arguments i must go to: Run -> Set Project Configuration -> Customize. Then, enter "BlankFiller" into the Main Class field. Then in the arguments field enter "retromingent purple lactose-intolerant" Then click okay. I found where to input this information in a different place than described.(probably different version on netbeans). Anyway, i enter the information and i get this error while running the program.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at BlankFiller.main(BlankFiller.java:3)
The book I'm using mentions this error, but the solution is to enter the information in the arguments field as i said i did above. So, i have no idea why this is not working.
class BlankFiller {
public static void main(String[] args) {
System.out.println("The " + args[0]
+ " " + args[1] + " fox "
+ "jumped over the "
+ args[2] + " dog."
);
}
}
What the program should do is fill in the blanks (args).
In the example i'm using, it says to add arguments i must go to: Run -> Set Project Configuration -> Customize. Then, enter "BlankFiller" into the Main Class field. Then in the arguments field enter "retromingent purple lactose-intolerant" Then click okay. I found where to input this information in a different place than described.(probably different version on netbeans). Anyway, i enter the information and i get this error while running the program.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at BlankFiller.main(BlankFiller.java:3)
The book I'm using mentions this error, but the solution is to enter the information in the arguments field as i said i did above. So, i have no idea why this is not working.