Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Q.No.1 Explain Large scale map ? Q.No.2 Explain small scale map ?

Answered: 1 week ago

Question

3. Existing organizations and programs constrain behavior.

Answered: 1 week ago