Java Software Solutions >EX2.5 > Solution

Problem:

What is the output produced by the following statement? Explain.
System.out.println ("He thrusts his fists\n\tagainst" +
" the post\nand still insists\n\the sees the \"ghost\"");

Output:

Not Applicable

Solution:

The output produced is:
He thrusts his fists
 against the post
 and still insists
 he sees the "ghost"

Escape characters are used to go to the beginning of new lines (\n), to tab (\t), and to print quotation marks (\").

No comments:

Post a Comment