Ask 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 (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. 22 May, 14:37
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers