Advertisements
Advertisements
Question
Write a statement in Java to extract the last four characters from the word "SIMPLICITY".
Very Short Answer
Advertisements
Solution
System.out.println("SIMPLICITY".substring(6));
Explanation:
The substring() function extracts a segment of a string from start to end index-1. "SIMPLICITY".substring(6) extracts characters from index 6 to the end.
shaalaa.com
Is there an error in this question or solution?
2021-2022 (March) Official Board Paper
