0
can anyone show an example program using command line arguments ,utilising the string args[] in main()
4 Answers
+ 1
Command line argument is for command line input. I use CMD. I can't help you with netbeans since I don't use it. Error you're getting is indicating that you're not putting in any argument to fill the args array. I can't answer whether or not netbeans allows you to put in command line arguments.
0
class ArgumentTest{
public static void main(String[] args){
System.out.println(args[0]);
}
}
javac ArgumentTest.java
java ArgumentTest "hello"
0
I am trying to run in netbeans it's showing array index out of bound error. :(
0
anyway thnx bro for helping
..I just got the answer now after googling it... peace!