Java Bootcamp – Workbooks and Challenges
)}

Debugging Exercise 5

Goal: debug the Pyramid.java code.

From Java Bootcamp Resources -> Module 2 -> 8\. Exception Handling -> Debugging Workbooks open the folder, exercise-five.

If you can't find it, please download the updated resources from Github.

Debugging

The goal is to construct the following diagonal:

>>: a

>>:

>>:      b

>>:

>>:          c

>>:

>>:              d

>>:

>>:                   e

There are nine rows. The diagonal must skip every second row and output the next letter every third row.

However, the starter code prints the following:

>>: b c d e f g h i j k

>>: n o p q r s t u

>>: z { | } ~

Yikes! Use breakpoints to visualize the runtime. Watching the output line by line will help you debug the problem.

Helpful Hints:

  • You can increment (++) characters from a to z.

  • The first letter starts with b when it should be a. Fix that issue first.

  • The inner loop is printing way too many letters. Look into its condition.

Good Luck!

Feedback Summary
4.8
39 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.