Computer Applications
Output of the following statement is …………… .
System.out.println("WONDERFUL".substring(3,4));
- DERF
- NDER
- D
- N
Java String Handling
9 Likes
Answer
D
Reason — The function substring(startindex, endindex) returns a substring which begins from startindex and ends at endindex - 1.
Here, "WONDERFUL".substring(3,4) returns a substring which begins at startindex 3 and ends at endindex - 1, i.e., 4 - 1 = 3. The character at index 3 is D.
Answered By
4 Likes
Related Questions
The valueOf() method returns the …………… .
- string representation of the argument
- int representation of the argument
- boolean representation of the argument
- character representation of the argument
Output of the following statement is …………… .
System.out.println("SUNDAY".substring(3));- NDA
- DAY
- SUN
- N
How do you create strings implicitly and explicitly?
Mention the purpose and syntax of trim() method.