Check out example codes for "java check java version". It will help you in understanding the concepts better.

Code Example 1

java -version  #for jre version
javac -version  # for java compiler version

Learn ReactJs, React Native from akashmittal.com