Write a statement each to perform the following tasks on a string:

Views 34

Answer:

(i) Extract the second last character of a word stored in the variable wd.


char secondLastChar = wd.charAt(wd.length() - 2);

(ii) Check if the second character of a string str is in uppercase.


boolean isUpperCase = Character.isUpperCase(str.charAt(1));

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.