Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 11 students

String Substring Method Behavior

< Prev
Next >

All of the following statements about the String class’s substring method are true EXCEPT:

public class TestSubstring {
    public static void main(String[] args) {
        String s = "AP Computer Science";
        String sub = s.substring(3, 11);
        System.out.println(sub);
    }
}
A

When a non-zero start index is provided, substring returns the entire original string.

B

The substring method returns a portion of the string from the start index (inclusive) to the end index (exclusive).

C

If the indices provided are within range, substring returns a new String representing the specified section of the original.

D

Providing indices outside the valid range causes substring to throw an IndexOutOfBoundsException at runtime.

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2richa.tuli11 0m 21s 79
#3liuwilliam07241012 1m 39s -9
#4jeonsaw172312 1m 42s -12
#5pandasiteitei11 2m 43s -63
#6y.seong202713 3m 26s -126
#7psak1212 3m 42s -132
#8chunxiangxu.cxu03 5m 10s -340
#9lsj0803092212 32m 32s -1,862
Items per page:
10
1 – 9 of 9
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ