+ 3

How can we add ")" into a string?

I want to write a code that prints out ": )" when it runs. I tried this code: System.out.print(": )") But the Code Playground keeps pairing the ) between the quote marks with the ( before the quote marks. Does anyone have solution?

6th Apr 2018, 8:49 AM
Ibaadi Jaya
Ibaadi Jaya - avatar
4 ответов
+ 4
Workaround for now: char close_bracket = ')'; System.out.print(": " + close_bracket
6th Apr 2018, 9:39 AM
Emma
+ 5
Although Code Playground seems to "think" that the right parenthesis in the double quote is paired to the first left parenthesis, it isn't. System.out.print(": )"); works just fine. Nonetheless, you can provide a feedback to SL in order for the devs to quickly rectify this issue.
6th Apr 2018, 8:54 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Thank you... : )
6th Apr 2018, 8:57 AM
Ibaadi Jaya
Ibaadi Jaya - avatar
+ 4
Xan Oh my god I didn't think about that : )
6th Apr 2018, 11:17 AM
Ibaadi Jaya
Ibaadi Jaya - avatar