| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice Test
Share
easy Solved by 16 students
String Concatenation With The Plus Operator
< Prev
Next >

Which line correctly concatenates s1 and s2 with a space in between using the ‘+’ operator?

public class StringConcat {
    public static void main(String[] args) {
        String s1 = "AP";
        String s2 = "Computer";
        // Missing line: Combine s1 and s2 with one space in between using the '+' operator and assign to 'result'
        System.out.println(result);
    }
}
A

String result = s1 + " " + s2;

B

String result = s1.concat(" ").concat(s2);

C

String result = s1 + s2;

D

String result = s1.concat(s2);

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki23 0m 00s 190
#2y.seong202722 0m 33s 167
#3jeonsaw172322 0m 38s 162
#4sgarv251311 0m 00s 100
#5lsj0803092211 0m 19s 81
#6patrickmeijer00912 0m 17s 73
#7areeshaabdulrasheed01 0m 14s -24
#8frank.personal111101 0m 34s -44
#9richa.tuli11 3m 27s -107
#10psak1224 5m 41s -161
APFIVE © 2020.
Email: [email protected]|Privacy Policy