Question: This is Eclipse Debugging Question. Question #2: If you put a breakpoint on line #17, would you always hit it? If not, what condition would
This is Eclipse Debugging Question.
Question #2: If you put a breakpoint on line #17, would you always hit it? If not, what condition would need to be true to hit it? If youre not sure, put a breakpoint there and debug the program a few times.
Please copy, paste this java program in your eclipse.
package lab2Package; import java.util.Scanner; import java.util.Random; public class Lab2 { public static void main(String args[]) { Random r = new Random(); Scanner s = new Scanner(System.in); int num = r.nextInt(100)+1; //add one to change range from 0-99 to 1-100 inclusive... int guess = 0; int count = 0; while (guess != num) { count++; System.out.print("Enter your guess #"+count+"= "); guess = s.nextInt(); if (guess < num) { System.out.println("too low, try again!"); } // endif... if (guess > num) { System.out.println("too high, try again!"); } // endif... } // endwhile... System.out.println("Yes! It took you "+count+" tries"); s.close(); } // end main... } // endclass...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
