What is the result?

Class StaticField {
static int i = 7;
public static void main(String[] args) {
StaticFied obj = new StaticField();

obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + ” “+ obj.i);
}
}
What is the result?

Class StaticField {
static int i = 7;
public static void main(String[] args) {
StaticFied obj = new StaticField();

obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + ” “+ obj.i);
}
}
What is the result?

A.
10 10

B.
8 9

C.
9 8

D.
7 10



Leave a Reply 0

Your email address will not be published. Required fields are marked *