user3238181
user3238181

Reputation: 135

Special characters as Java constants

Is it possible to create a char constant in Java for special characters? Dragging the character into the code editor window doesn't seem to work.

In the Mac character palette, if I use the "copy character info" command on the "Clubs" card suit symbol, for example, it puts this on the clipboard: Unicode: U+2663 U+FE0F, UTF-8: E2 99 A3 EF B8 8F

Is is possible to use this somehow in a statement like:

public final char CLUB_SYMBOL = (?); 

Upvotes: 0

Views: 936

Answers (1)

blacktide
blacktide

Reputation: 12136

You can use the unicode escape syntax:

public final String CLUB_SYMBOL = "\u2663\ufe0f";

Upvotes: 1

Related Questions