DOS command-line compiler run java

The first step: coding

Write code in Notepad.

Affix into .java

public class HelloWorld
{
    public static void main(String[] args){
        System.out.print("Hello World!");
    }
}

 

Step Two: Compile Code

At the command line javac HelloWorld.java, if there is no error, and that folder appear , indicating successful compilation.

 

Step 3: Run Code

 At the command line, enter java HelloWorld.

Guess you like

Origin www.cnblogs.com/rumian/p/11944058.html