My string has double quotes in it, in C#
I would do:
string blah = @"this is my ""text";
how would I do that in Java?
My string has double quotes in it, in C#
I would do:
string blah = @"this is my ""text";
how would I do that in Java?
No. Such a feature is not available in Java.
From the Sun docs:
When an escape sequence is encountered in a print statement, the compiler interprets it accordingly. For example, if you want to put quotes within quotes you must use the escape sequence, \", on the interior quotes. To print the sentence
She said "Hello!" to me.
you would write
System.out.println("She said \"Hello!\" to me.");
There is nothing like it currently, but it is a "Fix understood" request for enhancement.
If added, this feature would allow such string literals:
String qry = @"
SELECT
a.name, b.number
FROM
User a, Data b
WHERE
a.name = "James"
AND
a.id = b.id
";
Some of the comments reject this principally on the fact that it's a syntactic sugar, but obviously there's high demand for it, so it's possible that we'll see this someday.