Computer Applications
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)
- boolean
- String
- int
- double
User Defined Methods
3 Likes
Answer
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)
Answered By
2 Likes
Related Questions
Consider the following statements:
Computer desktop = new Computer(); Computer Mainframe = new Computer();Name the objects of the class given above:
- Desktop, Mainframe
- desktop, Mainframe
- Computer, Mainframe
- Computer, desktop
The earth spins on its axis completing one rotation in a day. The earth revolves around the sun in 365 days to complete one revolution. What is the Java concept depicted in the given picture?

- Array
- Condition
- Nested loop
- While loop
In a calculator which Java feature allows multiple methods named calculate() for the different operations?
- abstraction
- inheritance
- encapsulation
- polymorphism
Assertion (A): The result of the Java expression 3 + 7/2 is 6.
Reason (R): According to the hierarchy of operators in Java, addition is done first followed by division.
- (A) is true and (R) is false.
- (A) is false and (R) is true.
- Both (A) and (R) are true and (R) is a correct explanation of (A).
- Both (A) and (R) are true and (R) is not a correct explanation of (A).