In Java, should I escape a single quotation mark (') in String (double quoted)? -


in java, \' denotes single quotation mark (single quote) character, , \" denotes double quotation mark (double quote) character.

so, string s = "i\'m human."; works well.

however, string s = "i'm human." not make compile errors, either.

likewise, char c = '\"'; works, char c = '"'; works.

in java, better use? in html or css, things style="font-family:'arial unicode ms';" more (and such tags, think it's way use quotation marks), in java, saw people use escape characters "i\'m human."

you don't need escape ' character in string (wrapped in "), , don't have escape " character in char (wrapped in ').


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -