In this article we demonstrate how to execute the compiled HelloWorld.java file, where the Java code is as follows:
public class HelloWorld { public static void main(String []args) { System.out.println("Hello World"); }}
Next we use the javac command to compile the Java file. After executing the command, it will be in the current directory A HelloWorld.class file will be generated. We can use the java command to execute the compiled file:
c:\jdk\demoapp> javac HelloWorld.java c:\jdk\demoapp> java HelloWorld
The output result of the above code example is:
Hello World
The above is the Java example - how to perform compilation Through the contents of the Java file, please pay attention to the PHP Chinese website (www.php.cn) for more related content!