Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
easy

Substring Extraction Logic

Mark
< Prev
Next >

A student attempts to extract specific segments from a course identifier string using substring indices. Determine the final concatenation of the two segments.

What is printed when the following Java program is compiled and run?

public class QuestionTrace {

    public static void main(String[] args) {
        String id = "APCS-2027";
        String part1 = id.substring(5, 9);
        String part2 = id.substring(0, 4);
        System.out.println(part1 + part2);
    }
}
A

2027APCS-

B

APCS2027

C

2027APCS

D

2027-APCS

Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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