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 i is an instance variable and s is static, shared by all objects of the Foo class.
You might also like to view...
Analysis of the EBK standards produced ____ critical work functions.
A. 14 B. 35 C. 41 D. 53
What is the Internet backbone? Describe how routers work with the Internet backbone.
What will be an ideal response?
What is Attributes?
What will be an ideal response?
A(n) ________ is an individual who works with a document that a developer has designed
A) technology analyst B) software engineer C) help-desk specialist D) end user