Home / Questions / Write a statement each to perform the following tasks on a string:
Explanatory Question

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

👁 89 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

(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));