Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I hit page 200 in the Java for dummies book and when he talks about Switches the author start using code like this
Code:
 details += "\tNew Car Scent, Plus...\n";

He dosen't explaine it and it may not be important but it confuses me and I just wanted to understand it.

thanks.

-Lars
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
Ahhh, but they are located within the quates " " 's. My understanding is that everything that is located between them is printed "Print this statement";

-Lars
 

Heath

macrumors regular
Aug 19, 2005
133
0
Canada
larswik said:
Ahhh, but they are located within the quates " " 's. My understanding is that everything that is located between them is printed "Print this statement";

-Lars

Yes, you are correct, everything in the quotes is printed. However there are things called 'escape sequences' these allow you to print characters you couldn't otherwise print in quotes. If you ponder a bit, how else could you print a double quote? Escape sequences are denoted by a \. So \n is the escape sequence for a new line and \t is the escape sequence for a tab. These are treated differently than normal text in the quotes. There are many escape sequences available your book probably covers them at some point, have a peek in the index.


hehe 3 minutes!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.