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
While designing a website, a(n) ____ allows you to identify the specific amount of space used on a particular page before it con
Aleks [24]
The answer would be A: wireframe, im pretty sure...

Hope this helped!! :)

8 0
3 years ago
Read 2 more answers
Which of the following is not a network category based on the geographic dispersion of network components?
barxatty [35]

Answer:B) Wide-Area Network (WAN)

Explanation: WAN(Wide area network)is the network which constitutes a large geographical region.This network consist of the small network unit as well as large network connections.This network does not have the geographic dispersion of the components of networks.

WAN works in geographic region for the dispersion between any two locations. Other options are incorrect because they connect the network components geographically. Thus the correct option is option(B).

7 0
4 years ago
Differentiate between time high and time low?
Y_Kistochka [10]
STAR PLATINUM ZA WARUDO... ORA ORA ORA ORA ORA ORA ORA ORA ORA
7 0
3 years ago
What were the results of Dr.bjork's experiment
Mademuasel [1]

Answer:

Studying in different rooms seemed to improve a persons memory

8 0
2 years ago
Select the two true statements about functions with parameters:
kondor19780726 [428]

Answer:

Option (B) and (C) is the correct option to the following question.

Explanation:

Because the function is the module of the program and we call that function again and again anywhere whenever we need that function in the program.

Function is used to carry out any operation which is used in the program many times and it creates the program short and simple.

<u>For example</u>: if we need to add or multiply two numbers many times in the program then, we create one or two functions for addition and subtraction or one program for both, when we need them we call them.

4 0
3 years ago
Other questions:
  • Write the program to solve quadratic equations, but if the discriminant is negative, output
    9·1 answer
  • A report that ends with the author providing his or her plan for next steps is considered a
    5·1 answer
  • What is the output of the following program segment? int main() { int num = 5; cout &lt;&lt; num &lt;&lt;" "; change(num); cout
    8·1 answer
  • A relational database is different from a simple database because it has more than one _____.
    13·1 answer
  • The options are file protection , fault-tolerance , fault line , file tolerance , and the question is which term describes the d
    6·1 answer
  • The data type that can hold decimal or fractional values
    14·1 answer
  • "If possible, always bring print-outs of your slides for your audience
    7·2 answers
  • PLZ HELP What will be the output? class num: def init (self.a): self. number = a mul* __(self. b) return self. number + b. numbe
    7·1 answer
  • Computer science is a blank process
    6·2 answers
  • What is a security strategy comprised of products and services that offer remote support for mobile devices, such as smart phone
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!