Open a command prompt window and go to the directory where you saved the java program (HelloWorld. java). …
Type ‘javac HelloWorld. java’ and press enter to compile your code.
Now, type ‘ HelloWorld ‘ to run your program.
You will be able to see the result printed on the window.