Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

write square bracket in string

807603Oct 26 2007 — edited Oct 26 2007
Hi
Just a short question (i hope). How can i write i square bracket in a string.

System.out.println("[");

Gives me the following exception on compiling:

Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0
[

Thank you
Carsten

Edited by: Carsten78 on Oct 26, 2007 12:59 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2007
Added on Oct 26 2007
5 comments
366 views