Exercises
Write HelloWorld, compile it and using
javap -c Helloworld try to identify the bytecode. Can you change the HelloWorld message without recompiling?
Enclose the println statement in a loop from 0 to 20 so that it prints 20 times HelloWorld. Compile using the -g flag and use jdb to debug. Put a breakpoint on HelloWorld.main and step by step execute. Experiment with jdb’s commands. Can you change the counter while debugging and print HelloWorld only five times?
Write a simple Timer class (that uses System.currentTimeMillis()) and benchmark with it three distinct java operations. Try to argue the validity of the results in the context of the JVM architecture (you might want to get some help from javap and jdb).