Check out example codes for "How do I compile and run a program in Java on my Mac?". It will help you in understanding the concepts better.

Code Example 1

cd ~
javac HelloWorld.java
//for running it
java HelloWorld

Learn ReactJs, React Native from akashmittal.com