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
drek231 [11]
3 years ago
14

What is the output of the second println statement in the main method? public class Foo { int i; static int s; public static voi

d main(String[] args) { Foo f1 = new Foo(); System.out.println("f1.i is " + f1.i + " f1.s is " + f1.s); Foo f2 = new Foo(); System.out.println("f2.i is " + f2.i + " f2.s is " + f2.s); Foo f3 = new Foo(); System.out.println("f3.i is " + f3.i + " f3.s is " + f3.s); } public Foo() { i++; s++;
Computers and Technology
1 answer:
never [62]3 years ago
6 0

Answer:

The second print statement will print:

f2.i is 1 f2.s is 2

Explanation:

Initially when the execution start. i and s are both 0. i declared as a variable while s is a static variable which value stays once it is re-defined.

When f1 call i and s; their value is both 1 based on the increment statement in the constructor.

For the second print statement:

When f2 call i; it is re-initialized to 1. When f2 call s; it has initial value of 1 and is incremented to 2 which is printed. s hold the initial value of 1 because of the static keyword.

You might be interested in
What is common for all machines​
Fed [463]

Answer:

the question is a bit vague, but all machines exist to serve a purpose, or to do or accomplish a certain task.

6 0
3 years ago
Read 2 more answers
What statement best describes operating systems?
GenaCL600 [577]

Answer:

An operating system, or "OS," is software that communicates with the hardware and allows other programs to run

3 0
3 years ago
Which quality should an experiment have to be replicable and valid? O clearly detailed results O a well-cited research paper O s
stiv31 [10]

Answer:a.) clearly detailed results

Explanation:

6 0
3 years ago
5. Something that has a value 2 points<br>is called a/an<br>O<br>NODE<br>POWER<br>O<br>ATOM​
morpeh [17]

Answer:

it's ONPOA

Explanation:

try use a board game by some of the pins or any type that is part of the game and see if that helps out.

6 0
4 years ago
What is one difference between a web page and a web application?
saul85 [17]

Answer:

A website is a group of globally accessible, interlinked web pages which have a single domain name. A web application is a software or program which is accessible using any web browser. Developing your website helps you in branding your business.

8 0
3 years ago
Other questions:
  • Which of the following is true regarding Moore’s Law? A.) explained the growth in computing capabilities between 1965 and 1995 B
    14·1 answer
  • What role do mobile devices play in shaping the world?
    5·2 answers
  • What is the symbol that causes the computer to perform string concatenation?
    5·1 answer
  • You would like to set up on online meeting to communicate with colleagues on a group project. Which of these tools should you su
    5·2 answers
  • Which of the following best describes Roblox?
    12·2 answers
  • Inattentional blindness occurs when individuals do not observe certain objects or events because they are focused on something e
    10·2 answers
  • Can someone help me
    12·2 answers
  • Which of the following represents the biggest difference between asymmetric and symmetric cryptography?
    9·1 answer
  • At each layer of the OSI model, data is appended to the original message and then sent on to the next lower layer. What is this
    10·1 answer
  • Complete the following statements by choosing the correct answer from the drop-down menus.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!