Difference between revisions of "Netbeans/C2/Netbeans-Debugger/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| Border=1
 
{| Border=1
 
 
|| '''Time'''
 
|| '''Time'''
 
|| '''Narration'''
 
|| '''Narration'''
  
 
|-
 
|-
| 00:01
+
|00:01
|Hii everyone.  
+
|Hello everyone.Welcome to the tutorial on '''Netbeans Debugger.'''
 
+
|-
+
| 00:02
+
| Welcome to the tutorial on '''Netbeans Debugger. '''
+
  
 
|-
 
|-
Line 18: Line 13:
 
|-
 
|-
 
|00:14
 
|00:14
|For this demonstration, I am using the Linux Operating System Ubuntu v12.04,
+
|For this demonstration, I am using the '''Linux Operating System Ubuntu''' version '''12.04'''
  
 
|-
 
|-
 
| 00:21
 
| 00:21
|and Netbeans IDE v7.1.1  
+
|and '''Netbeans IDE''' version '''7.1.1'''.
  
 
|-
 
|-
 
|00:26
 
|00:26
|We all know that '''debugging''' programs can be a rather painstaking task.  
+
|We all know that debugging programs can be a rather painstaking task.  
  
 
|-
 
|-
 
| 00:31
 
| 00:31
|Hence, knowing a '''debugging''' tool and being familiar with its features can help you save valuable time.  
+
|Hence, knowing a debugging tool and being familiar with its features can help you save valuable time.  
  
 
|-
 
|-
 
| 00:39
 
| 00:39
|This powerful '''debugging''' tool is very useful,  
+
|This powerful debugging tool is very useful,  
  
 
|-
 
|-
Line 42: Line 37:
 
|-
 
|-
 
| 00:46
 
| 00:46
|In this tutorial we will learn some of the features that the '''Netbeans Debugger''' provides.  
+
|In this tutorial, we will learn some of the features that the '''Netbeans Debugger''' provides.  
  
 
|-
 
|-
 
| 00:53
 
| 00:53
| This tutorial will acquaint you with
+
| This tutorial will acquaint you with-
  
 
|-
 
|-
 
|00:55
 
|00:55
|the '''debugging''' window  
+
| the debugging window  
  
 
|-
 
|-
 
|00:58
 
|00:58
|configuring breakpoints
+
| configuring '''breakpoint'''s
  
 
|-
 
|-
 
|01:00
 
|01:00
|evaluating expressions  or setting watches
+
| evaluating expressions  or setting watches
  
 
|-
 
|-
 
|01:04
 
|01:04
|options for tracing the execution of your program  
+
| options for tracing the execution of your program and
  
 
|-
 
|-
| 01:17
+
| 01:07
|and options to configure the '''debugger''' itself  
+
| options to '''configure''' the '''debugger''' itself.
  
 
|-
 
|-
 
|01:12
 
|01:12
|Now Let's get started and '''debug''' this sample code.  
+
|Now, Let's get started and '''debug''' this sample '''code'''.  
  
 
|-
 
|-
 
|01:17
 
|01:17
|I will switch to the Netbeans IDE  
+
|I will switch to the '''Netbeans IDE'''.
  
 
|-
 
|-
 
|01:20
 
|01:20
|I have already created a Java Application, '''sampleDebug''' in my IDE for this demonstration.  
+
|I have already created a Java Application- '''sampleDebug''', in my IDE, for this demonstration.  
  
 
|-
 
|-
 
|01:27
 
|01:27
|This is a small program that initializes three integer values a, b, and c.  
+
|This is a small program that initializes three integer values '''a''', '''b''', and '''c'''.  
  
 
|-
 
|-
 
|01:35
 
|01:35
|Then it prints''' 'Hello World!' ''' and the value of 'a'.  
+
|Then it prints "'''Hello World!'''" and the value of '''a'''.  
  
 
|-
 
|-
 
|01:40
 
|01:40
|It also creates a class object ''''SampleClass',''' which has a ''' 'value' ''' integer, as a private integer value.  
+
|It also creates a '''class''' object '''SampleClass''' which has a 'value' integer, as a '''private''' integer value.  
  
 
|-
 
|-
 
|01:52
 
|01:52
|Then, it computes the value of ''' 'b' ''',
+
|Then, it computes the value of '''b'''
  
 
|-
 
|-
 
|01:55
 
|01:55
| and calls a function to compute the value of c,  
+
| and calls a '''function''' to compute the value of '''c''',  
  
 
|-
 
|-
 
| 02:00
 
| 02:00
|and prints the values of 'b' and 'c'.  
+
|and prints the values of '''b''' and '''c'''.  
  
 
|-
 
|-
 
| 02:05
 
| 02:05
|To start with the '''debugging''', let us first set the breakpoint.  
+
|To start with the debugging, let us first set the '''break-point'''.  
  
 
|-
 
|-
 
| 02:09
 
| 02:09
|To set a breakpoint, click on the line number.  
+
|To set a '''break point''', click on the line number.  
  
 
|-
 
|-
 
| 02:13
 
| 02:13
|I will set at this line which prints ''' Hello World!'''
+
|I will set it at this line which prints "'''Hello World!'''".
  
 
|-
 
|-
 
| 02:18
 
| 02:18
|Notice that the line at which a breakpoint is set changes it's colour to pink and is marked by a small square against its line number.  
+
|Notice that the line at which a '''break-point''' is set, changes it's colour to pink and is marked by a small square against its line number.  
  
 
|-
 
|-
 
| 02:28
 
| 02:28
|When you run the program in the '''debugging''' mode,  
+
|When you '''run''' the program in the '''debugging''' mode,  
  
 
|-
 
|-
 
| 02:31
 
| 02:31
|by clicking on the ''' Debug Project''' button in the toolbar,  
+
|by clicking on the '''Debug Project''' button in the toolbar,  
  
 
|-
 
|-
 
|02:35
 
|02:35
| the execution of the program stops at the line at which the breakpoint is located.  
+
| the execution of the program stops at the line at which the '''breakpoint''' is located.  
  
 
|-
 
|-
 
|02:41
 
|02:41
|So far, 'a's value has been set.  
+
|So far, '''a'''s value has been set.  
  
 
|-
 
|-
Line 146: Line 141:
 
|-
 
|-
 
| 02:52
 
| 02:52
|You can see that there are some additional windows below the workspace.  
+
|You can see that there are some additional windows below the '''workspace'''.  
  
 
|-
 
|-
 
| 02:59
 
| 02:59
|There is a 'Variables' window that shows a list of variables and their values.  
+
|There is a ''''Variables'''' window that shows a list of variables and their values.  
  
 
|-
 
|-
 
| 03:07
 
| 03:07
|So far, only the variable 'a' has been initialized.  
+
|So far, only the variable '''a''' has been initialized.  
  
 
|-
 
|-
 
|03:11
 
|03:11
|We can also look at the 'Output' window with the sample '''debug''' output.  
+
|We can also look at the '''Output''' window with the '''sampleDebug''' output.  
  
 
|-
 
|-
Line 166: Line 161:
 
|-
 
|-
 
| 03:19
 
| 03:19
|There is also a  ''' 'Debugger Console' '''' that says that the program hit a breakpoint on line 29 and has stopped there.  
+
|There is also a  '''Debugger Console''' that says that the program hit a breakpoint on line 29 and has stopped there.  
  
 
|-
 
|-
 
| 03:28
 
| 03:28
|There is also a ''''Breakpoints' ''' window that tells you that a breakpoint has been set on line number 29.  
+
|There is also a '''Breakpoints''' window that tells you that a breakpoint has been set on line number 29.  
  
 
|-
 
|-
 
| 03:36
 
| 03:36
|Before proceeding, let us see how to add a watch.  
+
|Before proceeding, let us see how to add a '''watch'''.  
  
 
|-
 
|-
 
| 03:40
 
| 03:40
|For example, let us say I want to watch on the integer value ''' 'aSample'. '''
+
|For example, let us say, I want to watch on the integer value ''''aSample''''.
  
 
|-
 
|-
 
| 03:48
 
| 03:48
|In the 'Variables' window below the workspace, I will double-click on  the '''Enter new Watch''' option and enter the name of the variable  ''' 'aSample.value'. '''
+
|In the 'Variables' window, below the '''workspace''', I will double-click on  the '''Enter new Watch''' option and enter the name of the variable  "aSample.value".
  
 
|-
 
|-
 
| 04:02
 
| 04:02
|Click on '''OK. '''
+
|Click on '''OK.'''
  
 
|-
 
|-
 
| 04:06
 
| 04:06
|So far ''' 'aSample' ''' has not been created so it says it does not know the value.  
+
|So far, '''aSample''' has not been created. So, it says it does not know the value.  
  
 
|-
 
|-
 
| 04:12
 
| 04:12
|Once it executes the line we'll know what the variable contains.  
+
|Once it executes the line, we'll know what the variable contains.  
  
 
|-
 
|-
 
| 04:16
 
| 04:16
|In a similar way you can also watch and evaluate expressions.  
+
|In a similar way, you can also watch and evaluate expressions.  
  
 
|-
 
|-
 
| 04:21
 
| 04:21
| Here I'm checking for b=a+10.
+
| Here, I'm checking for b=a+10.
  
 
|-
 
|-
 
| 04:25
 
| 04:25
|What if I wanted to know what a-4 is.  
+
|What if I wanted to know what '''a-4''' is.  
  
 
|-
 
|-
 
| 04:29
 
| 04:29
|So let me go to the '''Debug''' menu in the menu bar, and select '''Evaluate expression''' option.  
+
|So, let me go to the '''Debug''' menu in the menu bar and select '''Evaluate expression''' option.  
  
 
|-
 
|-
 
| 04:37
 
| 04:37
|The ''' 'Evaluate Code' ''' window appears in the workspace.  
+
|The ''''Evaluate Code'''' window appears in the workspace.  
  
 
|-
 
|-
 
| 04:41
 
| 04:41
|Here I will enter the expression ''' 'a-4'.'''  
+
|Here, I will enter the expression '''a-4'''.
  
 
|-
 
|-
 
| 04:45
 
| 04:45
|Click on the '''Evaluate Expression button''' here, and in the Variable window, it says ''' 'a-4' '''s value is 6.  
+
|Click on the '''Evaluate Expression''' button here and in the '''Variable''' window, it says (a-4)'s value is 6.  
  
 
|-
 
|-
Line 234: Line 229:
 
|-
 
|-
 
| 05:06
 
| 05:06
|That should execute only that 1 single line  of the code to print ''' “Hello World”.'''  
+
|That should execute only that 1 single line  of the code to print '''Hello World'''”.
  
 
|-
 
|-
Line 242: Line 237:
 
|-
 
|-
 
| 05:17
 
| 05:17
| That says, '''Hello World! a is 10. '''
+
| that says, "Hello World! 'a' is 10".  
  
 
|-
 
|-
Line 250: Line 245:
 
|-
 
|-
 
| 05:28
 
| 05:28
|Now, I want to go into the constructor of the ''' SampleClass.'''  
+
|Now, I want to go into the '''constructor''' of the ''' SampleClass.'''  
  
 
|-
 
|-
 
| 05:32
 
| 05:32
|To that I can choose the ''' Step Into''' option from the toolbar.  
+
|To do that, I can choose the ''' Step Into''' option from the toolbar.  
  
 
|-
 
|-
 
| 05:41
 
| 05:41
|Then I can choose ''' Step Over''' and see that the value came inside the constructor call is now set to 10.  
+
|Then I can choose the '''Step Over''' and see that the value came inside the '''constructor call''' is now set to 10.  
  
 
|-
 
|-
 
| 05:51
 
| 05:51
| You can also check that by hovering on the variable.  
+
| You can also check that by hovering over the variable.  
  
 
|-
 
|-
 
| 05:55
 
| 05:55
|When I Step Over again, we can see that '''this.variable''' is also set to 10.  
+
|When I '''Step Over''' again, we can see that '''this.variable''' is also set to 10.  
  
 
|-
 
|-
 
| 06:03
 
| 06:03
|To get out of this function I can either choose '''Continue, Step Over or Step Out.'''  
+
|To get out of this function, I can either choose '''Continue, Step Over''' or '''Step Out.'''  
  
 
|-
 
|-
Line 278: Line 273:
 
|-
 
|-
 
| 06:14
 
| 06:14
|And now I'm back to where the function call was made.  
+
|And, now I'm back to where the '''function call''' was made.  
  
 
|-
 
|-
 
| 06:19
 
| 06:19
|When I say '''Step-Over''' again, you will notice that '''aSample.value''' is now set to10.   
+
|When I say '''Step-Over''' again, you will notice that '''aSample.value''' is now set to 10.   
  
 
|-
 
|-
Line 290: Line 285:
 
|-
 
|-
 
| 06:30
 
| 06:30
| Apart from Breakpoints and StepOvers, you can also stop the execution of the program at the line of the cursor.  
+
| Apart from '''Breakpoint'''s and '''Step Over'''s, you can also stop the execution of the program at the line of the cursor.  
  
 
|-
 
|-
Line 298: Line 293:
 
|-
 
|-
 
| 06:49
 
| 06:49
|Now from the toolbar, choose the '''Run To Cursor''' option.  
+
|Now, from the toolbar, choose the '''Run To Cursor''' option.  
  
 
|-
 
|-
Line 306: Line 301:
 
|-
 
|-
 
| 07:05
 
| 07:05
|You can see that it has computed the value of b, as 20.  
+
|You can see that it has computed the value of '''b''' as 20.  
  
 
|-
 
|-
 
| 07:10
 
| 07:10
|And inside the variable window, it has set 'b' to be 20.  
+
|And inside the '''Variable''' window, it has set '''b''' to be 20.  
  
 
|-
 
|-
 
| 07:14
 
| 07:14
|Now, I can choose '''Step Over''' again and d's value also gets initialized and becomes 15.  
+
|Now, I can choose '''Step Over''' again and 'd's value also gets initialized and becomes 15.  
  
 
|-
 
|-
Line 322: Line 317:
 
|-
 
|-
 
| 07:29
 
| 07:29
|Let me choose '''Step Out''' and come back to the function call.  
+
|Let me choose '''Step Out''' and come back to the '''function call'''.  
  
 
|-
 
|-
Line 334: Line 329:
 
|-
 
|-
 
| 07:47
 
| 07:47
|So, when we '''Step Over''' and execute that line, 'c' will get a value of 15.  
+
|So, when we '''Step Over''' and execute that line, '''c''' will get a value of 15.  
  
 
|-
 
|-
 
| 07:55
 
| 07:55
|We can now check it in the variable window or hover on the variable to check it's value.  
+
|We can now check it in the '''Variable''' window or hover on the variable to check it's value.  
  
 
|-
 
|-
 
| 08:03
 
| 08:03
|Now if you want to stop the '''debugging''' session, you can choose the '''Finish Debugger Session''' option from the toolbar.  
+
|Now, if you want to stop the debugging session, you can choose the '''Finish Debugger Session''' option from the toolbar.  
  
 
|-
 
|-
 
| 08:12
 
| 08:12
|If you want to continue the execution to the next breakpoint you can choose the '''Continue''' option.  
+
|If you want to continue the execution to the next breakpoint, you can choose the '''Continue''' option.  
 
   
 
   
 
|-
 
|-
 
| 08:19
 
| 08:19
|Once you finish, you can also choose the '''Continue option''' to complete the execution of the remaining program.  
+
|Once you finish, you can choose the '''Continue option''' to complete the execution of the remaining program.  
  
 
|-
 
|-
Line 358: Line 353:
 
|-
 
|-
 
| 08:27
 
| 08:27
|In the Output window, it shows me the output as: ''' b '''is 20 and '''c''' is 15.  
+
|In the '''Output''' window, it shows me the output as: '''b''' is 20 and '''c''' is 15.  
  
 
|-
 
|-
 
| 08:34
 
| 08:34
|Now, this was a quick overview of the options of '''debugging''' on '''netbeans. '''
+
|Now, this was a quick overview of the options of debugging on '''netbeans. '''
  
 
|-
 
|-
 
| 08:39
 
| 08:39
|If you want any advanced feature settings, you can -
+
|If you want any advanced feature settings, you can
  
 
|-
 
|-
 
| 08:42
 
| 08:42
|Go to '''Tools''' menu, click on '''Options''', go to '''Miscellaneous''' option, click on the '''Java Debugger''' tab.  
+
|go to '''Tools''' menu, click on '''Options'''. Go to the '''Miscellaneous''' option, click on the '''Java Debugger''' tab.  
  
 
|-
 
|-
 
| 08:53
 
| 08:53
|Here you can change settings for multi-threaded program breakpoint options.
+
|Here, you can change settings for multi-threaded program breakpoint options.
  
 
|-
 
|-
 
| 08:59
 
| 08:59
|Or have filters to decide on which methods you would want to step in.  
+
|Or, have '''filters''' to decide on which methods you would want to step in.  
  
 
|-
 
|-
 
| 09:07
 
| 09:07
|Now to the assignment.
+
|Now, to the assignment..
  
 
|-
 
|-
Line 390: Line 385:
 
|-
 
|-
 
| 09:16
 
| 09:16
|If not, introduce some errors with the logic or algorithm.  
+
|If not, introduce some errors with the '''logic''' or '''algorithm'''.  
  
 
|-
 
|-
 
| 09:20
 
| 09:20
|Set breakpoints in the code. Usually, you would set a break at the calling point of a function which you suspect has the error.  
+
|Set '''breakpoint'''s in the code. Usually, you would set a '''break''' at the calling point of a '''function''' which you suspect has the '''error'''.  
  
 
|-
 
|-
 
| 09:29
 
| 09:29
|Use '''Step-Into''' to go into the function.  
+
|Use '''Step Into''' to go into the function.  
  
 
|-
 
|-
 
| 09:32
 
| 09:32
|Use '''Step-Overs''' to execute the lines and make sure to inspect the values of variables in the variable window.  
+
|Use '''Step Over'''s to '''execute''' the lines and make sure to inspect the values of variables in the '''Variable''' window.  
  
 
|-
 
|-
 
| 09:41
 
| 09:41
|Add some watches to help you identify and correct the error.  
+
|Add some '''watch'''es to help you identify and correct the '''error'''.  
  
 
|-
 
|-
 
| 09:45
 
| 09:45
|Step-Out of the method.  
+
|Step Out of the method.  
  
 
|-
 
|-
Line 418: Line 413:
 
|-
 
|-
 
| 09:51
 
| 09:51
|And finally, Finish the '''debugger''' session and Run your application.  
+
|And finally, finish the '''debugger''' session and '''run''' your application.  
  
 
|-
 
|-
 
| 09:57
 
| 09:57
|In this tutorial, we became familiar with the '''netbeans debugger. '''
+
|In this tutorial, we became familiar with the '''Netbeans Debugger. '''
  
 
|-
 
|-
 
| 10:02
 
| 10:02
|We saw how to set breakpoints and watches.  
+
|We saw how to set '''breakpoint'''s and '''watch'''es.  
  
 
|-
 
|-
 
| 10:06
 
| 10:06
|Add expressions which we want to evaluate, while the code is running.  
+
|Add expressions which we want to evaluate while the code is running.  
  
 
|-
 
|-
 
| 10:11
 
| 10:11
|Trace execution of a program with '''Step-Into, Step-Over, Step-Out and Run-to-Cursor''' options.  
+
|Trace the execution of a program with '''Step-Into, Step-Over, Step-Out''' and '''Run-to-Cursor''' options.  
  
 
|-
 
|-
 
| 10:19
 
| 10:19
|Also saw how to configure the '''debugger''' for advanced '''debugging.'''
+
|Also, saw how to configure the '''debugger''' for advanced debugging.  
  
 
|-
 
|-
 
|10:24
 
|10:24
|Hope this tutorial saves you a lot of time in your testing and '''debugging''' tasks.  
+
|Hope this tutorial saves you a lot of time in your testing and debugging tasks.  
  
 
|-
 
|-
 
|10:30
 
|10:30
|Watch the video available at the link shown on the screen.  
+
|Watch the video available at the '''link''' shown on the screen.  
  
 
|-
 
|-
Line 454: Line 449:
 
|-
 
|-
 
|10:36
 
|10:36
|If you do not have good bandwidth, you can download and watch it
+
|If you do not have good bandwidth, you can download and watch it.
  
 
|-
 
|-
 
| 10:41
 
| 10:41
|The Spoken Tutorial project team conduct workshops using Spoken Tutorials.  
+
|The Spoken Tutorial project team: * conducts workshops using Spoken Tutorials.  
  
 
|-
 
|-
 
| 10:46
 
| 10:46
|Gives certificates to those who pass an online test.  
+
| Gives certificates to those who pass an online test.  
  
 
|-
 
|-
 
| 10:49
 
| 10:49
|For more details contact contact@spoken-tutorial.org
+
|For more details, contact:'''contact@spoken-tutorial.org'''
  
 
|-
 
|-
 
| 10:55
 
| 10:55
|Spoken Tutorial Project is a part of the Talk to a Teacher Project
+
|'''Spoken Tutorial''' project is a part of the '''Talk to a Teacher''' project.
  
 
|-
 
|-
 
| 10:59
 
| 10:59
| It is Supported by the National Mission on education through ICT, MHRD, Government  of India
+
| It is Supported by the National Mission on education through ICT, MHRD, Government  of India.
  
 
|-
 
|-
 
| 11:05
 
| 11:05
|More information on this mission is available at spoken-tutorial.org/NMEICT-Intro
+
|More information on this mission is available at:'''spoken-tutorial.org/NMEICT-Intro'''.
  
 
|-
 
|-
 
| 11:14
 
| 11:14
|This tutorial has been  contributed by IT for Change  
+
|This tutorial has been  contributed by '''IT for Change'''.
  
 
|-
 
|-
 
| 11:18
 
| 11:18
 
|Thank you for joining us.
 
|Thank you for joining us.

Latest revision as of 20:06, 10 September 2018

Time Narration
00:01 Hello everyone.Welcome to the tutorial on Netbeans Debugger.
00:06 If this is the first time you are using Netbeans, please view the earlier tutorials on the Spoken Tutorial website.
00:14 For this demonstration, I am using the Linux Operating System Ubuntu version 12.04
00:21 and Netbeans IDE version 7.1.1.
00:26 We all know that debugging programs can be a rather painstaking task.
00:31 Hence, knowing a debugging tool and being familiar with its features can help you save valuable time.
00:39 This powerful debugging tool is very useful,
00:42 especially when you have to code or test large programs.
00:46 In this tutorial, we will learn some of the features that the Netbeans Debugger provides.
00:53 This tutorial will acquaint you with-
00:55 the debugging window
00:58 configuring breakpoints
01:00 evaluating expressions or setting watches
01:04 options for tracing the execution of your program and
01:07 options to configure the debugger itself.
01:12 Now, Let's get started and debug this sample code.
01:17 I will switch to the Netbeans IDE.
01:20 I have already created a Java Application- sampleDebug, in my IDE, for this demonstration.
01:27 This is a small program that initializes three integer values a, b, and c.
01:35 Then it prints "Hello World!" and the value of a.
01:40 It also creates a class object SampleClass which has a 'value' integer, as a private integer value.
01:52 Then, it computes the value of b
01:55 and calls a function to compute the value of c,
02:00 and prints the values of b and c.
02:05 To start with the debugging, let us first set the break-point.
02:09 To set a break point, click on the line number.
02:13 I will set it at this line which prints "Hello World!".
02:18 Notice that the line at which a break-point is set, changes it's colour to pink and is marked by a small square against its line number.
02:28 When you run the program in the debugging mode,
02:31 by clicking on the Debug Project button in the toolbar,
02:35 the execution of the program stops at the line at which the breakpoint is located.
02:41 So far, as value has been set.
02:45 Hover on it to check it's value.
02:49 It indicates that it's value is 10.
02:52 You can see that there are some additional windows below the workspace.
02:59 There is a 'Variables' window that shows a list of variables and their values.
03:07 So far, only the variable a has been initialized.
03:11 We can also look at the Output window with the sampleDebug output.
03:17 There is no output yet.
03:19 There is also a Debugger Console that says that the program hit a breakpoint on line 29 and has stopped there.
03:28 There is also a Breakpoints window that tells you that a breakpoint has been set on line number 29.
03:36 Before proceeding, let us see how to add a watch.
03:40 For example, let us say, I want to watch on the integer value 'aSample'.
03:48 In the 'Variables' window, below the workspace, I will double-click on the Enter new Watch option and enter the name of the variable "aSample.value".
04:02 Click on OK.
04:06 So far, aSample has not been created. So, it says it does not know the value.
04:12 Once it executes the line, we'll know what the variable contains.
04:16 In a similar way, you can also watch and evaluate expressions.
04:21 Here, I'm checking for b=a+10.
04:25 What if I wanted to know what a-4 is.
04:29 So, let me go to the Debug menu in the menu bar and select Evaluate expression option.
04:37 The 'Evaluate Code' window appears in the workspace.
04:41 Here, I will enter the expression a-4.
04:45 Click on the Evaluate Expression button here and in the Variable window, it says (a-4)'s value is 6.
04:56 Let us now proceed and execute this single line of code.
05:00 To do that, choose the Step-Over button from the toolbar.
05:06 That should execute only that 1 single line of the code to print “Hello World”.
05:12 To see the output, go to the output window and choose the sampleDebug output window
05:17 that says, "Hello World! 'a' is 10".
05:22 The program has now stopped at the line to create a SampleClass object.
05:28 Now, I want to go into the constructor of the SampleClass.
05:32 To do that, I can choose the Step Into option from the toolbar.
05:41 Then I can choose the Step Over and see that the value came inside the constructor call is now set to 10.
05:51 You can also check that by hovering over the variable.
05:55 When I Step Over again, we can see that this.variable is also set to 10.
06:03 To get out of this function, I can either choose Continue, Step Over or Step Out.
06:11 Let me choose Step-Out to come out of the method.
06:14 And, now I'm back to where the function call was made.
06:19 When I say Step-Over again, you will notice that aSample.value is now set to 10.
06:27 This is what we were watching for.
06:30 Apart from Breakpoints and Step Overs, you can also stop the execution of the program at the line of the cursor.
06:38 For example, let me go into the function here and set the cursor to be on this line which says d=b-5; .
06:49 Now, from the toolbar, choose the Run To Cursor option.
06:54 You will notice that the execution of the program gets into the function and stops at the line where the cursor is located.
07:05 You can see that it has computed the value of b as 20.
07:10 And inside the Variable window, it has set b to be 20.
07:14 Now, I can choose Step Over again and 'd's value also gets initialized and becomes 15.
07:23 Now, I can either choose to return or completely finish the execution of the program.
07:29 Let me choose Step Out and come back to the function call.
07:36 When you hover on the getC() function, you'll notice that the function has returned a value of 15.
07:43 The variable 'c' has not yet been assigned that value.
07:47 So, when we Step Over and execute that line, c will get a value of 15.
07:55 We can now check it in the Variable window or hover on the variable to check it's value.
08:03 Now, if you want to stop the debugging session, you can choose the Finish Debugger Session option from the toolbar.
08:12 If you want to continue the execution to the next breakpoint, you can choose the Continue option.
08:19 Once you finish, you can choose the Continue option to complete the execution of the remaining program.
08:25 Let me choose Continue here.
08:27 In the Output window, it shows me the output as: b is 20 and c is 15.
08:34 Now, this was a quick overview of the options of debugging on netbeans.
08:39 If you want any advanced feature settings, you can
08:42 go to Tools menu, click on Options. Go to the Miscellaneous option, click on the Java Debugger tab.
08:53 Here, you can change settings for multi-threaded program breakpoint options.
08:59 Or, have filters to decide on which methods you would want to step in.
09:07 Now, to the assignment..
09:09 As an assignment, take any of your programs, excellent if it has already errors.
09:16 If not, introduce some errors with the logic or algorithm.
09:20 Set breakpoints in the code. Usually, you would set a break at the calling point of a function which you suspect has the error.
09:29 Use Step Into to go into the function.
09:32 Use Step Overs to execute the lines and make sure to inspect the values of variables in the Variable window.
09:41 Add some watches to help you identify and correct the error.
09:45 Step Out of the method.
09:48 Continue till you reach the next breakpoint.
09:51 And finally, finish the debugger session and run your application.
09:57 In this tutorial, we became familiar with the Netbeans Debugger.
10:02 We saw how to set breakpoints and watches.
10:06 Add expressions which we want to evaluate while the code is running.
10:11 Trace the execution of a program with Step-Into, Step-Over, Step-Out and Run-to-Cursor options.
10:19 Also, saw how to configure the debugger for advanced debugging.
10:24 Hope this tutorial saves you a lot of time in your testing and debugging tasks.
10:30 Watch the video available at the link shown on the screen.
10:33 It summarizes the Spoken Tutorial project.
10:36 If you do not have good bandwidth, you can download and watch it.
10:41 The Spoken Tutorial project team: * conducts workshops using Spoken Tutorials.
10:46 Gives certificates to those who pass an online test.
10:49 For more details, contact:contact@spoken-tutorial.org
10:55 Spoken Tutorial project is a part of the Talk to a Teacher project.
10:59 It is Supported by the National Mission on education through ICT, MHRD, Government of India.
11:05 More information on this mission is available at:spoken-tutorial.org/NMEICT-Intro.
11:14 This tutorial has been contributed by IT for Change.
11:18 Thank you for joining us.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14