Given:

public class Test {
	private int sum;
	public int compute() {
 		int x = 0;
 		while (x < 3) {
  			sum += ++x;
 		}
 		return sum / 4;
	}
	public static void main(String[] args) {
 		Test t = new Test();
 		int sum = t.compute();
 		sum = t.compute();
 		t.compute();
 		System.out.println(sum);
	}
}

What is the result?

An exception is thrown at runtime

6

3

9

Correct Option - c

To get all Infosys Certified Java SE11 Developer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in