Debugging Exercise 10
Goal: debug the Transpose.java
code.
From Java Bootcamp Resources
-> Module 2
-> 8. Exception Handling
-> Debugging Workbooks
open the folder, exercise-10
.
Debugging
The transpose of a matrix reverses the columns and rows. In other words, each row from the original matrix becomes a column in the new matrix.
Your code starts with the following matrix:
>>: [1, 2, 3]
>>: [4, 5, 6]
>>: [7, 8, 9]
The goal is to transpose it:
>>: [1, 4, 7]
>>: [2, 5, 8]
>>: [3, 6, 9]
But, your code produces:
>>: [1, 4, 7]
>>: [4, 5, 8]
>>: [7, 8, 9]
Use breakpoints to visualize the runtime. Watching the output line by line will help you debug the problem.
HINT: The solution may involve creating another 2D array.
Good Luck!
Feedback Summary
4.7
43 students
5
91%
4
2%
3
0%
2
0%
1
7%
Written Reviews
There are no written reviews yet.