Question: 1. View the code below and indicate where each variable would have scope. (Circle all boxes for each variable in which that variable would be
1. View the code below and indicate where each variable would have scope. (Circle all boxes for each variable in which that variable would be useable.
class DoLittle { public static void main(String[] args) { int number = 3;
double cost = 11.00; while(number >= 0) { int value = 7;
if(value > 5){ value = value + 2; number = number - 1;
String message = good job!;
}
} value = 9;
System.out.println(cost); } }
Variables In which blocks is each useable?
number main method while loop if block
cost main method while loop if block
value main method while loop if block
message main method while loop if block
in java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
