Ask Question
23 May, 06:09

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.

+4
Answers (1)
  1. 23 May, 10:06
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers