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
Simora [160]
4 years ago
15

What is the output of the second println statement in the main method?

Computers and Technology
1 answer:
Doss [256]4 years ago
3 0

Answer:

B. f2.i is 1 f2.s is 2

Explanation:

In Java there are two type of variables, first is static variables and second is instance variable. static variable class variable which means you can have only one variable for all instance of that class. But instance variable will only for instance/object of that class.

For this code example, i is and instance variable, for every instance of class Foo, there will be separate i variable. but s is a static variable and that will be associated with class.

So in this program the first instance incremented the s variable and changed its value to 1 as int's default value is 0 in the constructor. So for second instance, the s value changed to 2 that's why it prints f2.s as 2 and as we know i is instance variable and every instance of foo class have there own copy of i variable so it's value will remain same for every instance.

You might be interested in
User authentication is a procedure that allows communicating parties to verify that the contents of a received message have not
Goryan [66]

Answer:

False

Explanation:

A User Authentication is a process in which you verify that someone who is attempting to access services and applications is who they claim to be. This can be accomplished through a variety of authentication methods, such as entering a password into your laptop or phone or a PIN number into the ATM. Authentication is essential when you have content that you wish to protect and provide only to specific, approved clients.

3 0
3 years ago
Your job is to write a basic blurring algorithm for a video driver. The algorithm will do the following: it will go through all
nekit [7.7K]
I’m pretty sure answer is B let me know if I’m wrong
4 0
4 years ago
Access 1.04 knowing your audience
luda_lava [24]

Answer:

What?

Explanation:

I would like to help, but what is the question

4 0
4 years ago
Hey can you help we with this thanks
dimulka [17.4K]
Hey, it's easy, come on!
6 0
3 years ago
What is the 10/20/30 rule?
Sophie [7]
This represents Guy <span>Kawasaki Rule for PowerPoint Presentations. Here is what it stands for: 

</span><span>10 slides are the optimal number to use in a  presentation.
20 minutes is the longest amount of time that you should speak.
<span>30 point font is the smallest font that you should use on slides.


</span></span>
3 0
3 years ago
Other questions:
  • Windows server 2012 r2 supports two types of folder shares. what are those two types?
    6·1 answer
  • Write a method named lastFirst that accepts a string as its parameter representing a person's first and last name. The method sh
    13·1 answer
  • Explain the four basic operation performed by every computer​
    11·2 answers
  • Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
    10·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • The smallest unit of storage is​
    15·1 answer
  • Which type of network cable is commonly used to connect office computers to the local network
    13·1 answer
  • The development of the modern computer system has been evolutionary. Discuss this phenomenon and further discuss how current tre
    7·1 answer
  • Readable code
    12·2 answers
  • Who addicted to fnaf
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!