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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started