Hi, This is from Page 315 K&B book. How to solve this kind of questions ?
Place the fragments into the code to produce the output 33. Note, you must use each fragment exactly once.
class Incr {
public static void main(String[] args) {
Integer x = 7;
int y = 2;
x ___ ___;
___ ___ ___;
___ ___ ___;
___ ___ ___;
System.out.println(x);
}
}
FRAGMENTS:
Answer:
class Incr {
public static void main(String[] args) {
Integer x = 7;
int y = 2;
x *= x;
y *= y;
y *= y;
x -= y;
System.out.println(x);
}
}