Question: Consider the following code segments: public static void main(String[] args) {.........................(1) int enigma = 12;...............................................(2) int mystery = 15;..............................................(3) int riddle = 30; ............................................... (4)
Consider the following code segments:
public static void main(String[] args) {.........................(1)
int enigma = 12;...............................................(2)
int mystery = 15;..............................................(3)
int riddle = 30;...............................................(4)
while(riddle>mystery) {........................................(5)
int result = myMethod(mystery, riddle);......................(6)
System.out.println(result); ..................................(7)
riddle--; ....................................................(8)
mystery++; ...................................................(9)
}..............................................................(10)
System.out.println(DONE!);...................................(11) }................................................................(12)
private static int myMethod(int enigma, int mystery) {...........(13)
int riddle = enigma * mystery;.................................(14)
return riddle;.................................................(15)
}................................................................(16)
What are the line numbers of the lines that are in the scope of the variable result declared at line 6?
What are the line numbers of the lines that are in the scope of the variable riddle declared at line 4?
What are the line numbers of the lines that are in the scope of the variable riddle declared at line 14?
What are the line numbers of the lines that are in the scope of the variable enigma declared at line 2?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
