After installing the JDK, you can compile and execute a simple Java program,
One, Javac, Java
Relationship of path name and package name:
Under D, build the folder test, create the file Java1.java in test (the class name should be the same as the file name)
Java1.java:
Package Test;
public class JAVA1
{
public static void Main (string[] args)
{
System.out.println ("Hello World");
}
}
Commands to use:
D:\Test\javac Java1.java---> Get java1.class
Because the Java1.java inside uses the package test, this time if does not change the path, must under the test new folder test,
Use command D:\Test\java JAVA1-No,
D:\Test\java TEST.JAVA1-I can't find the file
Use the command D:\Test\javac. Java1.java----Get the folder corresponding to the package
Use the command D:\Test\java TEST.JAVA1 or D:\Test\java test\java1 to get the correct results
After obtaining the corresponding folder, using D:\Test\Test\java Java1 is also incorrect,
Second, the general class and the main class difference.
Java Learning II: Javac Java Learning (original)