1.

Which of these methods of class String is used to check whether a given object starts with a particular string literal?(a) startsWith()(b) endsWith()(c) Starts()(d) ends()This question was posed to me by my college director while I was bunking the class.The origin of the question is String Comparison topic in division String Handling of Java

Answer»

Right answer is (a) startsWith()

The BEST I can explain: Method startsWith() of STRING class is USED to check whether the String in question starts with a specified string. It is a specialized FORM of method regionMatches().



Discussion

No Comment Found

Related InterviewSolutions