1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
wariber [46]
3 years ago
7

2-Write test programs in java to determine the scope of a variable declared in a for statement. Specifically, the code must dete

rmine whether such a variable is visible after the body of the for statement

Computers and Technology
1 answer:
ankoles [38]3 years ago
7 0

Answer:

See Explaination

Explanation:

public class testscope

{

//start of main function

public static void main(String[] args)

{

//varible declration

int i;

int x;

//loop for 10 times

for(i=0; i<10; i++)

{

//initialize value of x to 10

x = 10;

}

//the scope of variable x is visible outside of for loop

System.out.println("The value of x is: "+x);

}

}

See attachment for sample output

nb:

You can clearly see in the output of Java program the value of x is not printed and program return errors. It means the variable x declared inside for loop does not has scope outside the for loop.

You might be interested in
Rafael needs to add a title row to a table that he has inserted in Word. What should he do? Use the alignment options. Use the M
raketka [301]

Answer:

Answer is C

Explanation:

6 0
2 years ago
Read 2 more answers
What are the inputs that the model uses to make decisions?
hodyreva [135]

Answer:

It makes the decision better and adds ownership in the implementation

Explanation:

Hope this helps C:

~Chiena

8 0
2 years ago
How important "saving" in every individual?​
photoshop1234 [79]

Answer:

The importance of saving money is simple: It allows you to enjoy greater security in your life. If you have cash set aside for emergencies, you have a fallback should something unexpected happen. And, if you have savings set aside for discretionary expenses, you may be able to take risks or try new things.

4 0
2 years ago
What did Bill Gates invent?
Viktor [21]
He invented microsoft.
8 0
3 years ago
Read 2 more answers
9. A change in the appearance of a value or label in a cell
alexandr402 [8]

Answer:

format

alignment

excel

=

Explanation: i'm an accountant

4 0
2 years ago
Other questions:
  • If num is an int which expression always evaluates to true if num holds an odd number
    14·1 answer
  • NEED HELP PLEASE-
    7·2 answers
  • In order to consolidate your theoretical knowledge into technique and skills with practical and applicational value, you will us
    8·1 answer
  • Which of the following is the main consideration when choosing an appropriate outlet box?
    7·2 answers
  • What is data? and types ??
    9·2 answers
  • Bridge building is the business of: pure scientists, civil servants, or civil engineers?
    11·2 answers
  • A researcher develops a new instrument to measure coping skills and conducts a pilot study to compare the new tool with an exist
    5·1 answer
  • What electronic device can represent a KiloByte?
    14·1 answer
  • An animation of a person standing with their arms extended out to their sides. There are 3 dimensional boxes around the torso of
    5·1 answer
  • Which source would provide the best way to find valid information about climate change
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!