Method prototype for the method compute which accepts two integer arguments and returns true/false.
- (a)void compute (int a, int b)
- (b)boolean compute (int a, int b)
- (c)Boolean compute (int a,b)
- (d)int compute (int a, int b)
Show SolutionHide Solution↓
boolean compute (int a, int b)
Reason — Let's analyse the given options:
void compute (int a, int b)— Incorrect becausevoidmeans the method does not return any value, but the question requires the method to returntrue/false.boolean compute (int a, int b)— Correct because it returns abooleanvalue (trueorfalse) and accepts two integer arguments.Boolean compute (int a, b)— Incorrect due to syntax error (int bis not fully declared). Also,Booleanis a wrapper class, not a primitiveboolean.int compute (int a, int b)— Incorrect because the return type isint, notboolean.