Advertisements
Advertisements
प्रश्न
Given that:
String pm = "Albert Einstein";
qm = pm.endsWith("in");
What is the datatype of qm?
विकल्प
int
char
String
boolean
MCQ
Advertisements
उत्तर
boolean
Explanation:
The endsWith() method checks whether a string finishes with a specific suffix, which can only result in a true or false answer. Therefore, Java requires the receiving variable qm to be a boolean datatype (evaluating to true in this case).
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: String Handling - Exercises [पृष्ठ २४५]
