I am using Java 8 update 251
The error that shows up:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at first_project.main(first_project.java:6)
I am using Java 8 update 251
The error that shows up:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at first_project.main(first_project.java:6)
The error is displayed as you are not passing any parameter while running the program. Try running the program from command line and passing argument. Eg:
c:\> java MyFirstJavaProgram arg0_value
or you can provide argument in Run Configuration of eclipse as well.
This program is expecting a command line argument; if you run this with Eclipse it will cause this issue. You need run this program from the shell with the proper arguments.
Compile file:
javac java_filepathofFile argument
Use java to run:
java class_filepathofFile argument