Computer Applications
Answer
startsWith() | endsWith() |
---|---|
startsWith() tests if the string object starts with the string specified as its argument. | endsWith() tests if the string object ends with the string specified as its argument. |
Example: String str = "ICSE Computer Applications"; boolean res = str.startsWith("ICSE"); System.out.println(res); The output of this code is true as str begins with "ICSE". | Example: String str = "ICSE Computer Applications"; boolean res = str.endsWith("tions"); System.out.println(res); The output of this code is true as str ends with "tions". |