In the following method prototype to accept a character, an integer and return YES or NO, fill in the blank to complete the method prototype.
public ............... someMethod(char ch, int n)
- (a)boolean
- (b)String
- (c)int
- (d)double
Show SolutionHide Solution↓
String
Reason — The method is required to return "YES" or "NO", which are textual values. In Java, such values are represented using the String data type. Hence, the return type of the method should be String, not boolean, int, or double.
The complete method prototype:
public String someMethod(char ch, int n)