Here is a simple Java program that demonstrates how to print a message to the console using the HotSpot 12 Java Virtual Machine (JVM):
public class Main { public static void main(String[] args) { System.out.println("Hello from HotSpot 12!"); } }
To compile and run this program using the HotSpot 12 JVM, you can use the following commands:
javac Main.java java Main
This will output the following to the console:
Hello from HotSpot 12!
You can also specify the version of the HotSpot JVM to use by passing the -version
option to the java
command:
java -version Main
This will print the version of the HotSpot JVM that is being used to run the program.