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

Java Loop Printing Output

< Prev
Next >

Consider the following code segment.

public class PrintStars {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            // missing line
        }
    }
}

Which statement, when substituted for // missing line, will cause the program to print an asterisk (*) followed by a new line for each iteration of the loop?

A

System.out.println(“*”);

B

System.out.print(“*”);

C

printLine(“*”);

D

System.out.println(“*\n”);

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
#1sgarv251311 0m 00s 100
#2y.seong202711 0m 07s 93
#3Pelisx11 0m 19s 81
#4kimtrinhqldacamle11 0m 29s 71
#5hitrishabhatia14 0m 00s 70
#6suhanakochhar00612 0m 51s 39
#7midnightasdark11 1m 07s 33
#8yuvansankarnyc11 2m 27s -47
#9bommasam00012 18m 50s -1,040
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