how to compile a java program in mac terminal code example
Example 1: How do I compile and run a program in Java on my Mac?
cd ~
javac HelloWorld.java
//for running it
java HelloWorld
Example 2: java in terminal
jshell
| Welcome to JShell -- Version 12.0.1
| For an introduction type: /help intro
jshell> int i=99;
i ==> 99
jshell> System.out.println(i);
99