Java examples - how to execute compiled Java files
In this paper, we demonstrate how to perform compiled HelloWorld.java file that Java code is as follows:
public class HelloWorld { public static void main(String []args) { System.out.println("Hello World"); } }
Next we use javac command to compile Java files, after executing the command generates a HelloWorld.class file in the current directory, we can use the java command to execute the compiled file:
c:\jdk\demoapp> javac HelloWorld.java c:\jdk\demoapp> java HelloWorld
The output is the above code examples:
Hello World