212k views
2 votes
Which line(s) immediately flush the output buffer?

1. System.out.print("One for the money");
2. System.out.print("Two for the show\\");
3. System.out.println("Three to get ready");
4. System.out.print("And four to go");
5. System.out.flush();
a. line 5 only
b. lines 3 and 5
c. lines 2, 3 and 5
d. every line

1 Answer

5 votes

Answer:

lines 2,3 and 5 ( c )

Step-by-step explanation:

The lines that immediately flush the output buffer are : System.out.print("Two for the show\\"); . System.out.println("Three to get ready"); and System.out.flush();

making use of the new line character or printIn() statement the buffered output gets flushed therefore making autoflush true

but System.out.print() doesn't use any flush technique so we need to flush the buffered output done by the print() statement hence we choose lines 2,3,5

User Joly
by
4.8k points