JDB Example with Introduction, JDB Tutorial, Architecture, Installation, Expression, Connection, Commands, Example, Breakpoint, Stepping, Options, Exception Handling etc.
In this section, we will learn how to initialize and run java debugger with the help of an example.
- Create a simple java program
- public class JDBExample
- public static void main(String...kk)
- int a=10, b=20;
- int c=a+b;
- System.out.println("Sum of two number : "+c);
- Open command prompt and compile your main class with the following command:-
- Now, initialize Java debugger with the following command:-
- The next task is to run java class. So, run the main class with the below command:-
After the execution of command, the following result will be generated on the console.