Simple program Debugging in Eclipse

Simple Fibonacci program:

		
package com.gk; public class FibonacciNumber { public static void main(String[] args) { int n=5,i,f0=1,f1=1,f2=0; for (i=1;i<=n;i++) { f2=f0+f1; f0=f1; f1=f2; f2=f0; System.out.println(f2); } } }

The above program is successfully compiled and it prints the output as get in Console below

		
Output: 1 2 3 5 8

But before going to run this program the compiler checks the program is Syntactically and Symmetrical. The program is correct now run the program its takes the responsibility for JVM. The JVM will run the program if the program is correct, otherwise it throws the ‘Runtime Error’s or Exceptions’. To identify which type of Errors are getting in the Eclipseit is easy to solve the problem (i.e) to debug the program.

How to use the Debugging in Eclipse:

In Eclipse Extra feature is it is easy to debug the program. Double click on before statement. That is debugging point start to their it is shown below

Simple Program

Now right click on Run the Debug As option in that Click on the Java Application as shown below

DebugAs option

Now you get a window like below, click on the Yes button

Perspective Swich_window

Now Debugging is Started as shows set by set process and storing values.

Debugging Mode

To move to the next statement in debugging press F6 button, the control will goes to the next statement. Pervious statement will be executed. To move continues the debugging statements is executed.(press F6)

Debug steps

Finally the debug at the end point shows the output in Console as shown below.

Output
HTML Comment Box is loading comments...