System.out.println("1 big bad wolf\t8 the 3 little pigs\n4 dinner\r2night");


Consider the following statement:

System.out.println("1 big bad wolf\t8 the 3 little pigs\n4 dinner\r2night");


This statement will output ___ lines of text

a) 1

b) 2

c) 3

d) 4

e) 5

Answer: b. Explanation: The \t escape sequence inserts a tab, but leaves the cursor on the same line. The \n escape sequence causes a new line to be produced so that “4 dinner” is output on the next line. The escape sequence \r causes the carriage to return (that is, the cursor to be moved back to the left margin) but because it does not start a new line, “2night” is output over “4 dinn” resulting in a second line that looks like “2nighter”.