?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

Print vs Println Text Output

APCSA-4NJK6W

Consider the following code.

System.out.print("red");
System.out.println("green");
System.out.print("blue");
System.out.println("yellow");
System.out.print("pink");

Which of the following is printed as a result of running these commands?

A

red-green-blue
yellow-pink

B

red
green-blue
yellow-pink

C

red-green
blue-yellow
pink

D

red-green-blue-yellow-pink

E

red
green
blue
yellow
pink