Title: Eclipse Debugger
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Eclipse Debugger

Debugging is discussed in this video. Strategic placement of print statements can go a long way towards providing information to assist in debugging your code. However, there comes a time where a debugger can be very useful. In this video, we go through the fundamentals of debugging in Eclipse.

Debugger features covered in this video:

- Break Points - place to have your program temporarily stop
- Single Step (Step Over) - Do one program statement and stop again
- Resume - Goto the next break point
- Step Into - When a method call is the current statement, this allows us to step into the method instead of skipping over it and going to the next instruction
- Step Return - When in a method, this allows us to return to the calling method
- Terminate button - stop our program
- Variables window - place to see the values of local variables
- Breakpoint window - place to see your current break points
- Deadly Eclipse "Source Not Found Error"
- Step Filters: goto Window/Preferences/Java/Debug/Steop Filtering and set all of the filters on.

We also discuss some Eclipse problem areas along with solutions to these problem areas. The program used in the video can be found below:


import java.util.Scanner;


public class Fibonocci {

    static int fibFunc(int n)
    {
        int oldest = 0;
        int previous = 1;
        int fib = n;
        if (n >= 2)
        {
            for (int i=2; i <= n; i++)
            {
                fib = oldest+previous;
                oldest = previous;
                previous = fib;
            }
        }
        return fib;
    }



    public static void main(String[] args) {
        int n;
        String continueResponse="y";
        Scanner keyboard = new Scanner(System.in);

        while (continueResponse.equals("y"))
        {
            System.out.println("Enter in N: ");
            n = keyboard.nextInt();

            int oldest = 0;
            int previous = 1;
            int fib = n;
            if (n >= 2)
            {
                for (int i=2; i <= n; i++)
                {
                    fib = oldest+previous;
                    oldest = previous;
                    previous = fib;
                }
            }
            System.out.println("Fibonocci(" + n + ")=" + fib );

            fib = fibFunc(n);
            System.out.println("Fibonocci(" + n + ")=" + fib );

            System.out.println( "Do you want to continue?: (y/n)");
            continueResponse = keyboard.next();
        }
        System.out.println("Have a good day");
        keyboard.close();

    }

}


Last updated: June 4, 2014 2:33 PM