LilProblems
LilProblems

Reputation: 727

How to use Escape sequences in JAVA

Hi I am having issues with this JAVA class. I know this is simple stuff but it just isn't working for me.

The code I have so far is this:

    public class ShowEscapeSequences {
    public static void main(String[] args) {
        System.out.print("I really like \n\t\"CIS355A\"Business Application Programming with Lab using JAVA\"");
    }//End of main
}

and it gives this output:

 I really like 


    "CIS355A"Business Application Programming with Lab using JAVA"

But I need the output to look like this:

I really like

    CIS355A 
         "Business Application Programming with Lab using JAVA"

How do I do this without generating 100 errors?

Upvotes: 0

Views: 5727

Answers (2)

Jeff
Jeff

Reputation: 820

Your string needs to be

"I really like\n\n\tCIS355A \n\t\t \"Business Application Programming with Lab using JAVA\""

This is based on looking at the raw text in the question.

Upvotes: 5

Crazenezz
Crazenezz

Reputation: 3456

System.out.print("I really like\n\n\tCIS355A \n\t\t\ "Business Application Programming with Lab using JAVA\"");

Upvotes: 2

Related Questions