What is the result? What is the result? What is the result? A. 8 9 B. 9 8 C. 10 10 D. 7 10 Explanation: Show Hint ← Previous question Next question →
renko Answer: C Code Question: public class StaticField { static int i = 7; public static void main(String[] args) { StaticField obj = new StaticField(); obj.i++; StaticField.i++; obj.i++; System.out.println(StaticField.i + ” “+ obj.i); } } Output: 10 10 Reply
Why “C.10 10”? Wrong overload, the same argument. My answer “Compilation failed”
I agree
I meant to reply to vyacheslafka. The question/answers don’t match up.
complitaion error
The question/answers don’t match up.
The answare is “three”
Answer: Compilation time error.
Compilation failed.
no answer
Answer: C
Code Question:
public class StaticField {
static int i = 7;
public static void main(String[] args) {
StaticField obj = new StaticField();
obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + ” “+ obj.i);
}
}
Output:
10 10