final class SimpleException extends Exception { public SimpleException() {} public String msg = "This is a simple exception"; native void nativeMethod1(); // the generated il should NOT call Runtime.handleException() method native void nativeMethod2() throws java.io.IOException; // the generated il should call Runtime.handleException() method } class ChildClass extends SimpleTest { ChildClass(int i) { super(i); } void testLock(boolean throwit) throws SimpleException { System.out.println("ChildClass.testLock() called"); super.testLock(throwit); } } class SimpleTest implements Runnable { private int which; transient int x; volatile int y; //java.awt.Button button; // test constant field static final int ONE = 1; final String JOHN = "\u0007John"; static final boolean b = true; static final char c = 'h'; static final short s = -234; static final int i = 100; static final long l = 123456789; static final float f = 123456789.10f; static final double d = 123456789.123456789; final int pData = 1000; static int age = 0; static { int l = 100; age = 32 + l; } public static void main(String argv[]) { SimpleTest st = new SimpleTest(1000); st.run(); // running in another thread Thread t = new Thread(st); t.setName("Second Thread"); t.start(); } public void run() { System.out.println(Thread.currentThread().getName()); System.out.println(new SimpleTest(1).JOHN); String s = "\u0003Hello World"; System.out.println(s); test(); new SimpleTest(1000).testDupX(); testArrayInitializer(); testForLoop(); testWhileLoop(5); testTypeCast(s); testLabelledStatement(6); SimpleTest st = new SimpleTest(1000); System.out.println(st.which); System.out.println(st.increment(100)); ArrayTest(); testSwitch(15); testSwitch_0(15); testSwitch_0(-150); testSwitch_1(10); testSwitch_1(1); testSwitch_2(6); testSwitch_2(1); testSwitch_3(6); testSwitch_3(1); testException(true); testException(false); testFinally(true); testFinally(true); testFinally(false); testFinally(false); testFinally(true); testFinally(false); testFinally(false); testFinally(true); testFinally(false); testFinally(false); testFinally(false); st = new SimpleTest(100); st.testSynchronizedMethod(); try { st.testLock(false); st.testLock(true); } catch (SimpleException e) { System.out.println(e.msg); } st = new ChildClass(1000); try { st.testLock(false); st.testLock(true); st.testLock(true); } catch (SimpleException e) { System.out.println(e.msg); } System.out.println(testStringBuffer(1234)); } static void testArrayInitializer() { int[] a = {1, 2, 3, 4, 5}; for (int i=0; i