Topics Discussed: Using the built in debugger to show us what is happening within our programs

Source Code for Lesson 4 here:

import java.util.Scanner;
 class Jtutorial1 {
    public static void main(String args[]){
       Scanner input = new Scanner(;
       // Logic errors -- When your code works, but the thought that created them, was flawed.
       // Code errors -- Syntax, incorrect naming, invalid calls, calling from bad locations.
       // I = P*R*T
       //int interest = P*R*T;
       int i =0, j=0;
       i = 2*6-2+18/9+3;
       j = 1+9-6+2*7/4;
       int k= i*j;
    } //End main
} //End class

In this lesson we look at some of the most common errors that we’ll be running into throughout learning to code.

Common error messages

; expected

This one is fairly simple it means that at some point you left out a semicolon

} expected

This is the same basic idea as above.

Using the built-in-debugger:
Using the debugger to better understand how our programs are running behind the scenes will teach us a lot about how the program acts, but also how our code handles things. To run the debugger, go up to the debug menu, and simply select “step into / step over”

Below is a cheat sheet on what each thing in the debugger means.

Step over- Go to the next line (and execute it)
Step over expression- Step over individual expressions within a statement
Step into: Go into a method
Step into next method:  Run everything to the next method.
Run to cursor: Compile normally until when they insertion point is reached.
Last modified: April 7, 2019