Assume the following lines are a part of the main method. You must show two executions -
Fantastic news! We've Found the answer you've been seeking!
Question:
Assume the following lines are a part of the main method. You must show two executions - one successful and one failure Use input values that result in a success and in a failure. Your answer must include everything that a user would see on the console.
Scanner in = new Scanner(System.in);
final int val = 4;
System.out.println("Enter a number");
int num = in.nextInt();
// val = 6;
System.out.print(num + "" + num * val + "" + num % val * val);
in.close();
Now uncomment the line where val is reset to 6. What would the effect be?
Related Book For
Engineering Fluid Mechanics
ISBN: 9781118880685
11th Edition
Authors: Donald F. Elger, Barbara A. LeBret, Clayton T. Crowe, John A. Robertson
Posted Date: