Ask Question
16 February, 07:26

What is the output of the second println statement in the main method, public class foo { int i; static int s; public sttic void main (string[] args) { foo f1 = new foo (); system. out. println ("f1, i is " + f1. i + f1. s is " + foo f2 = new foo (); system. out. println (" f2. i is " + f2. i + f2. s is " + foo f3 = new foo (); a) f2. i is 1 f2. s is 1. b) f2. i is 1 f2. s is 2. c) f2. i is 2 f2. s is 2. d) f2. i is 2 f2. s is 1. e) f2. i is 0 f2. s is 1.

+3
Answers (1)
  1. 16 February, 10:42
    0
    b) f2. i is 1 f2. s is 2

    Explanation:

    i is an instance variable and s is static, shared by all objects of the Foo class.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is the output of the second println statement in the main method, public class foo { int i; static int s; public sttic void main ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers