What will be the output of the following code?

public class BaseClass {

private int display1(int i)

{ return i++ + --i; }

public int display2(int i)

{ return display1(--i + 1); }

}

class ChildClass extends BaseClass

{

int display1(int i) // Line1

{ return display2(++i + ++i + --i); // Line2 }

}

class MainClass {

public static void main(String[] args) {

System.out.println("Value is " + new ChildClass().display1(27));

}}

Value is 168

Value is 169

Value is 170

Value is 171

Verified Answer
Correct Option - c

To get all Infosys Certified Java Programmer Exam questions Join Telegram Group https://rebrand.ly/lex-group-70b557

Telegram

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

Updated on Tue, 16 Sept 2025