How to insert a special character?

2019-09-08 02:00发布

问题:

I need to insert a cent character, how can I do it:

JOptionPane.showInputDialog("Please choose the number of cents,
"should be the symbol of cents");

There should be method with char.

回答1:

Java supports Unicode source file:

JOptionPane.showInputDialog("Please choose the number of ¢: "); should work!



回答2:

Java supports Unicode out of the box. Just insert ¢ into the string literal. If that doesn't work, try \u00A2.



回答3:

You are right there is a special command that you can use, I guess it is 169...But Java accepts almost any special characters, so you may simply find it online and copy paste



标签: java char