Requirement:
-
Method name: compute
-
Accepts two integer arguments → (int a, int b)
-
Returns true/false → the return type should be boolean
Step 1: Check options
(a) void compute(int a, int b) → ❌ void means no return value
(b) boolean compute(int a, int b) → ✅ Correct, returns a primitive boolean
(c) Boolean compute(int a, int b) → ✅ Technically correct too, returns wrapper class Boolean, but usually we use boolean for primitives
(d) int compute(int a, int b) → ❌ Returns integer, not true/false
✅ Best Answer: (b) boolean compute(int a, int b)
Note: Option (c) is technically valid but primitive boolean is standard for such cases.