This doesn't seem to work.
String stuff = "System.out.println("This is a string")";
note, I am NOT trying to print what the inside println is calling. I'm actually looking to print out THIS actual statement to the screen.
System.out.println("this is a string");
I don't want this string to be evaluated as a method call. I want to literally print this statement.
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
I'm using this so that I can test regex to look for valid names in a java document.
and I'm trying to make my regex ignore all words inside of quotation marks and words inside of comments.
The parser gets a bit confused when you have quotes within quotes - to get quotes inside of a String, you have to place a special character before it called an escape character. In java, I think it's a backslash: \
String stuff = "System.out.println(\"This is a string\")";
that should work.
Here are the other characters that can be 'escaped' in java: http://stackoverflow.com/questions/1367322/what-are-all-the-escape-characters-in-java