CSC300: A basic setup: Debugging [13/37] Previous pageContentsNext page

01
02
03
04
05
06
07
08
09
10
11
  /* A main function for debugging -- change the name to "main" to run it */
  public static void main2 (String[] args) {
    //Trace.graphvizOutputFormat ("svg");
    //Trace.drawSteps ();
    //Trace.drawStepsOfMethod ("contains");
    //Trace.drawStepsOfMethod ("containsHelper");
    //Trace.run ();
    double[] list = new double[] { 5, 11, 5, 5 };
    boolean result = contains (5, list);
    StdOut.println ("result: " + result);
  }

This simple test will allow us to use the debugger to watch the program's execution.

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

Trace.drawStepsOfMethod("contains") causes a drawing to be created at every step of the contains method. The drawings will be created in a folder on your Desktop. To change the location, or for further discussion, see here.

Previous pageContentsNext page