CSC300: run and draw [3/6] Previous pageContentsNext page

01
02
03
04
05
06
07
08
09
10
11
12
13
package algs11;
import stdlib.*;
public class Hello {
  public static void main (String[] args) {
    Trace.run ();
    int i = 0;
    while (i < 3) {
      Trace.draw ();
      StdOut.println (i);
      i = i + 1;
    }
  }
}

The stdlib package contains a class Trace which can be used to visualize the execution of programs.

Trace.run() causes the program to be run in a debugger.

Trace.draw() causes a drawing to be created. The drawings will be created in a folder on your Desktop. To change the location, or for further discussion, see here.

Previous pageContentsNext page