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 type of software is used for marketing research as a way to find out about users' preferences?
kogti [31]

Answer:

Adware

Explanation:

It's software that displays advertisements to users and gauges their preferences

8 0
3 years ago
The Internet began when a large company wanted to sell products online
aalyn [17]
No!The internet began in the 1950s when the US government was trying to use connected computers to compete with the Soviet Union's Sputnik. Hope this helps :)
6 0
3 years ago
Please Help!
Alex787 [66]

The three default components listed in the inspector view of a terrain assets are: Terrain, Terrian Collider  and Texture.

So the answer is Transform.

If you use the Move tool then click and drag an object while holding CTRL and Shift at the same time, it will snap the object to intersection points of the Collider; allowing stacking of objects automatically.

So the answer is Stack objects automatically.

3 0
3 years ago
Read 2 more answers
In a complex system, many subsystems interact with one another. How do these systems interact in terms of inputs and outputs?
Artemon [7]

Answer:

I think in there transmission you know inputs into ports like for their own

Explanation:

likeslike Spanish and is obviously inputs and outputs their portsinto the portsdifferent ports you know

4 0
3 years ago
In this lab, you complete a prewritten Python program for a carpenter who creates personalized house signs. The program is suppo
ivolga24 [154]

Using the computer language in python to write a function code that personalized house signs

<h3>Writting the code in python:</h3>

<em>#Assign varibles</em>

<em>charge = 0.00</em>

<em>numChars = 8</em>

<em>color = "gold"</em>

<em>woodType = "oak"</em>

<em />

<em>#Checking for number of characters</em>

<em>if numChars > 5:</em>

<em>charge = 35 + (numChars-5)*4</em>

<em>elif numChars > 0:</em>

<em>charge = 35</em>

<em />

<em>#Checking wood type</em>

<em>if woodType == "oak":</em>

<em>charge += 20</em>

<em />

<em>#Checking for color</em>

<em>if color == "gold":</em>

<em>charge += 15</em>

<em />

<em>#Print output</em>

<em>print("The charge for this sign is $"+str(charge)+".")</em>

See more about python at brainly.com/question/13437928

#SPJ1

5 0
2 years ago
Other questions:
  • Define the missing function. licenseNum is created as: (100000 * customID) + licenseYear. Sample output:
    10·2 answers
  • Do you need to know javascript to learn python?
    8·1 answer
  • In round-robin scheduling,a) the time quantum should be larger than the context switch time. b) the time quantum should be as sm
    15·1 answer
  • Swiping up with three fingers on mac os x launches what?
    8·1 answer
  • You are configuring IP settings on a new network. For the external interfaces, you decide to obtain registered IP addresses from
    5·1 answer
  • 1024 Megabytes = ____________
    14·1 answer
  • The concept of "space" on a computer usually refers to the___.​
    7·1 answer
  • You are given the task of reading in n numbers and then printing them out in sorted order. Suppose you have access to a balanced
    12·1 answer
  • Write the code for invoking a method named sendObject. There is one argument for this method which is of type Customer. Assume t
    14·1 answer
  • What are different social phenomenas are you aware of that used part of a social movement, change, or cause
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!