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
which program monitors the computer by looking for known trouble makers as well as suspicious behavior​
lys-0071 [83]

Answer:

i think spyware because spyware can collect almost any type of data, including personal information like internet surfing habits, user logins, and bank or credit account information. Spyware can also interfere with a user's control of a computer by installing additional software or redirecting web browsers.

Explanation:

3 0
3 years ago
Which statement describes borders and shading ?
Marina CMI [18]

Answer: Borders are rules you can add to any or all of the four sides of a paragraph. Shading is the color or artistic design you use as background for a paragraph. Borders and shading are formatting tools for enhancing text, paragraphs, table cells or frames.

3 0
3 years ago
Explain how technology is related to human needs and wants?
Burka [1]

Technology is what makes up the world. It makes life easier, and technology has been around since humans were first evolved. Our questionative behavior is what separates us from other animals. Our need for more is what runs humankind. Using technology to gain more, our kind becomes smarter, which is why we dominate other species. Technology millions of years ago could be a club to kill prey for food, and now, it is how we order essentials. Technology is an easier way to gain something, and since technology is all over the world, humankind will always have their need and want for more.

6 0
3 years ago
For local travel addresses and street names should be
saul85 [17]
Capitalized  and properly spelled 

8 0
3 years ago
What is an effective way to record change management? (5 points)
yanalaym [24]

Answer:

Detailed Notes

Explanation:

I took the 2.04 quiz

3 0
3 years ago
Other questions:
  • Chris has just graduated from high school. He hopes to complete a carpenter's apprenticeship and eventually open his own busines
    9·2 answers
  • is a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources th
    9·1 answer
  • You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudo
    14·1 answer
  • Two of the major sources used today for obtaining information to create computer maps are satellites and _____________.
    11·2 answers
  • What feature allows you to access previous copies of a document on OneDrive?
    15·2 answers
  • 2ND LAST QUESTION
    13·1 answer
  • You’ve found the file you’ll be working with. Next, you decide to move
    13·1 answer
  • Who plays oblox .............................
    8·2 answers
  • Does anyone have any tips on how to begin a 10 page Capstone project paper? I've got to write a write a research paper on the ty
    14·2 answers
  • . prevalence of coronary artery disease in patients with isolated aortic valve stenosis. br heart j. 1984;51:121–4.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!