Java Quotes in strings

August 10, 2006

Another one of those small things that trip you up every now and then (I always seem to forget when I need it), is having a string with quotations within it in a language such as Java. Here is how its done:

To have quotations within a string use the backslash \” before the quote.

String hello = “Hello \”Hello\” Hello”;

would produce Hello “Hello” Hello.  I think this format is used across many languages but I’m not too sure on that.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: