The output should be similar to that shown (your number might be different)
>javac -version
javac 18.0.2.1
Check Java Runtime Environment (JRE) Version
Here we run java with the flag.
The output should be similar to that shown (your numbers might be different)
>java -version
java version "18.0.2.1" 2022-08-18Java(TM) SE Runtime Environment (build 18.0.2.1+1-1)Java HotSpot(TM) 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing)