Computer Applications

Output of the following statement is …………… .

System.out.println("SUNDAY".substring(3));

  1. NDA
  2. DAY
  3. SUN
  4. N

Java String Handling

6 Likes

Answer

DAY

Reason — The substring() method returns a substring of the given string, which begins with the character at the specified start index and extends to the end of the string.

Here, the start index is 3 so the substring starts from 'D' and continues till the end of the string. So, the substring returned is "DAY".

Answered By

2 Likes


Related Questions