巴扎黑2017-04-17 11:40:04
For the first picture, you compiled it in the directory of the java file, right? javac Test2.java
But because this file has been declared package
, it only serves as a directory, and an error is reported directly in place java Test2
. However, if you create a directory java_study
at this time, and then put the class file into it, then java java_study.Test2
that will be fine. It's running.
ps: package mainly plays the role of directory //I rarely use the command line to compile and run java, so skipping it directly is a failure