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

```
public class Foo {
int i;
static int s;

public static void 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++;
}
}
```
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


b. f2.i is 1 f2.s is 2
i is an instance variable and s is static, shared by all objects of the Foo class.

Computer Science & Information Technology

You might also like to view...

A structural element that has content containing tangential or side issues to the main topic of the page is a(n) ______.

A.

B.
C.
Computer Science & Information Technology

A button that can be turned on by clicking it once, and then turned off by clicking it again

a. icon b. switch c. toggle

Computer Science & Information Technology

The _______ is the area between the content and the border

a. border b. spacing c. padding d. margin

Computer Science & Information Technology

Which of the following can a host use as its address when its own IPv6 address is not yet known?

A) :: B) ::1 C) 1:: D) FD::

Computer Science & Information Technology