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
Rom also called main memory or system memoryis used to stor the essential parts of the operating while the computer is running /
zimovet [89]
RAM*

But yes true, it’s a primary, volatile system
7 0
3 years ago
Pls help... : Slide layouts can be changed by _____.
Eddi Din [679]

Answer:

Selecting a new layout from the task pane

Explanation:

6 0
3 years ago
oe, a user, receives an email from a popular video streaming website. the email urges him to renew his membership. the message a
ale4655 [162]

Where Joe, a user, receives an email from a popular video-streaming website and the email urges him to renew his membership. If the message appears official, but Joe has never had a membership before, and if when Joe looks closer, he discovers that a hyperlink in the email points to a suspicious URL, note that the security threat that this describes is: "Phishing" (Option B)

<h3>What is Phishing?</h3>

Phishing is a sort of social engineering in which an attacker sends a fake communication in order to fool a person into disclosing sensitive data to the perpetrator or to install harmful software, such as ransomware, on the victim's infrastructure.

To avoid phishing attacks, make sure you:

  • understand what a phishing scheme looks like
  • Please do not click on that link.
  • Get anti-phishing add-ons for free.
  • Don't provide your information to an untrusted website.
  • Regularly change passwords.
  • Don't disregard those updates.
  • Set up firewalls.
  • Don't give in to those pop-ups.

Learn more about Phishing:
brainly.com/question/23021587
#SPJ1

Full Question:

Joe, a user, receives an email from a popular video streaming website. The email urges him to renew his membership. The message appears official, but Joe has never had a membership before. When Joe looks closer, he discovers that a hyperlink in the email points to a suspicious URL.

Which of the following security threats does this describe?

  • Trojan
  • Phishing
  • Man-in-the-middle
  • Zero-day attack
5 0
2 years ago
Write the code for invoking a static method named sendTwo, provided by the DataTransmitter class. There are two arguments for th
MAVERICK [17]

Answer:

DataTransmitter.sendTwo(15.955, 13);

Explanation:

The code above will call the method sendTwo() which exists inside the class DataTransmitter

Because this a static method it can be invoked with only the dot operator without making an object of the DatTransmitter class with the new Operator

Since the method sendTwo () accepts two parameters of type double and int respectively, the values 5.955, 13 are passed as argument during the method call.

5 0
3 years ago
Compare and contrast between first and second generation of computer<br>​
noname [10]
Frist gen of computers took forever to load and would crash if someone els in the house picked up the phone now adays are computers are in our pockets. There our phones and they rarely if ever crash
8 0
3 years ago
Other questions:
  • _ is a model of computing in which computer processing, storage, software, and other services are provided as a shared pool of v
    10·1 answer
  • PHP is based on C rather than ______.
    5·1 answer
  • What file extension is used to name a compressed folder
    10·1 answer
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    8·2 answers
  • printArray is a method that accepts one argument, an arrayof int. The method prints the contents of the array; it does not retur
    5·1 answer
  • Write a function strlen_recursive which accepts a pointer to a string and recursively counts the number of characters in the pro
    6·1 answer
  • Which of the following methods is a static method? The class in which the method is defined is given in parentheses following th
    5·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    9·1 answer
  • The sequence of instructions performed to execute one program instruction
    12·1 answer
  • Choose which statement is wrong by applying your knowledge from the reading. a. A security manager works on tasks identified by
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!