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
makkiz [27]
3 years ago
7

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

ine whether such a variable is visible after the body of the for statement
Computers and Technology
1 answer:
xxMikexx [17]3 years ago
6 0

Answer:

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        for(int i = 1; i < 10; i++){
  4.            int num = 0;
  5.            num += i;
  6.        }  
  7.        System.out.println(num);
  8.    }
  9. }

Explanation:

In programming each variable has its scope. For example, a variable defined within the for loop has no longer exist outside the loop body. To illustrate this we can write a short program as presented above.

Firstly, create a for loop that traverse the number 1 - 10 (Line 5 - 8). Within the loop create a variable num and initialize it with zero (Line 6) and increment it with i value for each iteration (Line 7).

Outside the loop, we try to print the num (Line 9). When we run the program this will result in an error as the num which is declared inside the for loop will no longer exist outside the loop body.  

You might be interested in
Given the message size of 16Kb, packet size of 2Kb, speed of 4Kbps over 3 links, how much time, will it take the message to trav
ruslelena [56]

Answer:

5 seconds

Explanation:

Given that :

Message size = 16kb

Packet size = 2kb

Speed = 4kbps

Number of links = 3

The time taken is calculated using the formula :

[Number of packets + (Number of links - 1)] * (packet size / speed)

Number of packets = message size / packet size

Number of packets = 16kb / 2 kb = 8

Hence,

[Number of packets + (Number of links - 1)] * (packet size / speed)

(8 + (3 - 1)) * (2 / 4)

(8 + 2) * (1 /2)

10 * 1/2

= 5 seconds

6 0
3 years ago
Let's say you are a UX researcher working on the design of a major social media application, let's call it QuickTalk. QuickTalk
ELEN [110]

UX design has five stages and they are:

  • empathize,
  • define,
  • ideate,
  • prototype,  
  • test

<h3>What is UX design?</h3>

This refers to the design process that aims to make a program that gives its users a great experience.

Hence, we can see that your question is incomplete so I gave you a general overview to help you get a better understanding of the concept.

Read more about UX design here:

brainly.com/question/13186084

#SPJ1

6 0
2 years ago
Help please?
Paraphin [41]
Hmmmm. I believe it would be scroll bars. I'm not in technology class but that's my best guess
7 0
4 years ago
What do we call stores in a physical world?
djyliett [7]

Answer:

brick and mortar stores i believe

6 0
3 years ago
Write the difference between:
JulsSmile [24]

Answer:

RAM is used to store computer programs and data that CPU needs in real time. ... RAM data is volatile and is erased once computer is switched off. HDD,hard disk has permanent storage and it is used to store user specific data and operating system file

3 0
4 years ago
Read 2 more answers
Other questions:
  • A device that modulates digital data onto an analog signal and then demodulates the analog signal back to digital data is a ____
    8·1 answer
  • You are doing research for a current event report on smartphone technology. You do a web search for information that includes se
    5·2 answers
  • What is the purpose of the print area feature​
    11·1 answer
  • 3) An example of interactive web page is<br>​
    11·1 answer
  • Develop a Python module that will prompt the user for a target sum that is greater than 0 and less than 1 for the following Geom
    13·1 answer
  • What does pdf stand for in computer terms?
    15·1 answer
  • What is the term for a combination of user name and domain name that identifies a user so he or she can receive Internet email?
    6·1 answer
  • The status bar only lets you view the current X, Y and Z coordinates of the cursor. Select one: True False
    8·2 answers
  • Choose the answer. Janice's IT department found that her computer had a program on it that was collecting her personal informati
    5·1 answer
  • Public class Dog
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!