Presentation is loading. Please wait.

Presentation is loading. Please wait.

Wrapper Classes Debugging Interlude 1

Similar presentations


Presentation on theme: "Wrapper Classes Debugging Interlude 1"— Presentation transcript:

1 Wrapper Classes Debugging Interlude 1
2/12/15 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

2 Objectives Define the terms bug and debugging.
Explain what a compile-time error is. Explain what an execution-time error is. Give examples of compile-time errors. Give example of execution-time errors. Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

3 Bugs and Debugging Bug Debugging Debugger Any error in a program.
Grace Hopper's team logged a "bug" in 1945 Debugging Fixing errors. Debugger Special software to help fix programs. Usually part of IDEs like eclipse. Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

4 Syntax Errors Error that keeps the program from compiling.
Missing or Extra Semicolons Spelling and Capitalization Missing quote, parenthesis, or braces Missing operators Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

5 More Syntax Errors Missing concatenation in println
Unintialized Variables Not assigned value DebugSyntax Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

6 Execution-Time Errors
Logical Errors in a program Examples Incorrect Arithmetic. Divide by zero. Bad input. Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010

7 Debugging Techniques Visually inspect the code (not every test requires modifying/running the code). Manually set a variable to a value. Insert print statements to observe variable values. Comment out unused code. Example in DebugExecution.java

8 Using eclipse Debugger
Can set breakpoints. Can inspect variable contents.

9 Questions What is the difference between a syntax error and a execution error? Does Java always give helpful error messages? What can you do to help debug logic errors?


Download ppt "Wrapper Classes Debugging Interlude 1"

Similar presentations


Ads by Google