Advertisements
Advertisements
Question
Return data type of isDigit(char ch) is:
Options
char
boolean
Boolean
bool
MCQ
Advertisements
Solution
boolean
Explanation:
- Purpose: The Character.isDigit(char ch) method in Java checks whether a character is a numeric digit (0-9).
- Return Value: Since the check can only result in a true or false outcome, it returns a primitive boolean value.
- Language Rule: Java uses lowercase boolean for this primitive type, unlike bool in C++ or the Boolean wrapper class object.
shaalaa.com
Is there an error in this question or solution?
