iteration and debugging
play

Iteration and Debugging Check out Iteration from SVN Loop review - PowerPoint PPT Presentation

Iteration and Debugging Check out Iteration from SVN Loop review Debugging Java programs using Eclipse While loop syntax: while ( condition ) { statements } In SVN, look at Investment.java and InvestmentRunner.java Q1,2 For


  1. Iteration and Debugging Check out Iteration from SVN

  2.  Loop review  Debugging Java programs using Eclipse

  3.  While loop syntax: while ( condition ) { statements } ◦ In SVN, look at Investment.java and InvestmentRunner.java Q1,2

  4.  For loop syntax: for ( initialization ; condition ; update ) { statements }  Do the Ra Rates es exercise in today’s homework  You’ll practice using a single for loop in that exercise  If you finish the Ra Rates exercise, start on the Pyr yramid amid Sch cheme eme exercise described in today’s homework  You’ll practice nested loops in that exercise

  5.  Sentinel value — a special input value not part of the data, used to indicate end of data set ◦ Enter a quiz score, or Q to quit:  A loop and a half — a loop where the test for termination comes in the middle of the loop  Examples… (on next slide) Q3,4

  6. // Pattern 1 // Pattern 2 boolean done = false; while (true) { while (!done) { // do some work // do some work if ( condition ) { if ( condition ) { break; done = true; } } else { // do more work // do more work } } } The variable done here is called a flag Q5

  7.  Breakpoint  Single stepping  Inspecting variables Q6

  8.  Debugging Java programs in Eclipse: ◦ Launch using the debugger ◦ Setting a breakpoint ◦ Single stepping: step over and step into ◦ Inspecting variables  Complete Wh WhackABug kABug exercise, continue with rest of homework Q7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend