Check out example codes for "how to see list of java of versions in mac". It will help you in understanding the concepts better.

Code Example 1

/usr/libexec/java_home -V

Learn ReactJs, React Native from akashmittal.com