How do I use args[0] from the terminal?
已回答
So I am currently learning about using input from the terminal.
From what I know you are suppose to type in "java" + the class name + then the string that you are entering.
This worked on Codeacademy using the same set up but I cannot seem to replicate the action using IntelliJ.
请先登录再写评论。
You forgot to run javac to compile your .java file or to specify classpath when running it. The error is about the class file not found, it has nothing to do with the parameters.
Note that IntelliJ IDEA compiles into the output directory which is different from the source directory.
See the first line in the console when IDE runs your app to see how classpath is configured.
Refer to the documentation of the java and javac command if you want to do the same from the terminal.