--------------------------------------- >more minmax.java class Minmax { public static void main (String[] args) { int x,y,z; x=2; y=3; if (xjavac Minmax.java >java Minmax 2 --------------------------------------- >java -version java version "1.1.1" --------------------------------------- >javac -g Minmax.java >jdb Minmax Initializing jdb... Warning: Thread.suspend() was called; Navigator deadlock might result 0xde326688:class(Minmax) > ? ** command list ** threads [threadgroup] -- list threads thread -- set default thread suspend [thread id(s)] -- suspend threads (default: all) resume [thread id(s)] -- resume threads (default: all) where [thread id] | all -- dump a thread's stack threadgroups -- list threadgroups threadgroup -- set current threadgroup print [id(s)] -- print object or field dump [id(s)] -- print all object information locals -- print all local variables in current stack frame classes -- list currently known classes methods -- list a class's methods stop in . -- set a breakpoint in a method stop at : -- set a breakpoint at a line up [n frames] -- move up a thread's stack down [n frames] -- move down a thread's stack clear : -- clear a breakpoint step -- execute current line cont -- continue execution from breakpoint catch -- break for the specified exception ignore -- ignore when the specified exception list [line number|method] -- print source code use [source file path] -- display or change the source path memory -- report memory usage gc -- free unused objects load classname -- load Java class to be debugged run [args] -- start execution of a loaded Java class !! -- repeat last command help (or ?) -- list commands exit (or quit) -- exit debugger > classes ** classes list ** 0xde300000:class(java.lang.Thread) ... LUNGA LISTA... 0xde326d30:class(netscape.debug.Debugger) 0xde326688:class(Minmax) > stop at Minmax:5 Breakpoint set at Minmax:5 > stop at Minmax:6 Breakpoint set at Minmax:6 > stop at Minmax:7 Breakpoint set at Minmax:7 > stop at Minmax:8 Breakpoint set at Minmax:8 > load Minmax 0xde326688:class(Minmax) > run Minmax Warning: Thread.suspend() was called; Navigator deadlock might resultrunning ... main[1] Warning: Thread.suspend() was called; Navigator deadlock might result Warning: Thread.suspend() was called; Navigator deadlock might result Warning: Thread.suspend() was called; Navigator deadlock might result Breakpoint hit: Minmax.main (Minmax:5) main[1] list 1 class Minmax { 2 public static void main (String[] args) { 3 int x,y,z; 4 5 => x=2; 6 y=3; 7 if (x y=3; 7 if (x if (x System.out.println(z); 12 } 13 } main[1] locals Method arguments: args = Local variables: x = 2 y = 3 z is not in scope. z = 2 main[1] step main[1] Warning: Thread.suspend() was called; Navigator deadlock might result Warning: Thread.suspend() was called; Navigator deadlock might result Warning: Thread.suspend() was called; Navigator deadlock might result Warning: Thread.suspend() was called; Navigator deadlock might result Breakpoint hit: Minmax.main (Minmax:11) main[1] cont 2main[1] exit --------------------------------------- >more Minmax.java class Minmax { public static void main (String[] args) { int x, y, z; x = 2; y = 3; if (x < y) z = x; else z = y; System.out.println(z); } } >javap -c Minmax Compiled from Minmax.java synchronized class Minmax extends java.lang.Object /* ACC_SUPER bit set */ { public static void main(java.lang.String[]); Minmax(); } Method void main(java.lang.String[]) 0 iconst_2 1 istore_1 2 iconst_3 3 istore_2 4 iload_1 5 iload_2 6 if_icmpge 14 9 iload_1 10 istore_3 11 goto 16 14 iload_2 15 istore_3 16 getstatic #6 19 iload_3 20 invokevirtual #7 23 return Method Minmax() 0 aload_0 1 invokespecial #5 4 return --------------------------------------- >more Numeri.java class Numeri { public static void main (String[] args) { int i,N=10; for (i = 1; i <= N; i++) System.out.println(i); } } >javap -c Numeri Compiled from Numeri.java synchronized class Numeri extends java.lang.Object /* ACC_SUPER bit set */ { public static void main(java.lang.String[]); Numeri(); } Method void main(java.lang.String[]) 0 bipush 10 2 istore_2 3 iconst_1 4 istore_1 5 goto 18 8 getstatic #6 11 iload_1 12 invokevirtual #7 15 iinc 1 1 18 iload_1 19 iload_2 20 if_icmple 8 23 return Method Numeri() 0 aload_0 1 invokespecial #5 4 return