1 - Run while adding new referenced class.
2 -- Running sayHi before redefinition
3Hello from TestClass sayHi function
4Goodbye from TestClass!
5 -- Adding NewClass to classloader!
6 -- Redefine the TestClass
7 -- call TestClass again, now with NewClass refs
8Hello again from TestClass sayHi function
9Hello from NewClass sayHi function
10Goodbye again from TestClass!
11 - Run without adding new referenced class.
12 -- Running sayHi before redefinition
13Hello from TestClass sayHi function
14Goodbye from TestClass!
15 -- Redefine the TestClass
16 -- call TestClass again, now with NewClass refs
17Hello again from TestClass sayHi function
18 -- Exception caught when running test without new class added! java.lang.NoClassDefFoundError
19 --- java.lang.NoClassDefFoundError At foobar.TestClass.sayHi(TestClass.java:5)
20