check the java version code example
Example 1: how to check which java version i have
java -version
Example 2: java check jre version
java -version #for jre version
javac -version # for java compiler version
java -version
java -version #for jre version
javac -version # for java compiler version