Stephan van Hulst wrote:. . . Before compilation . . . .
Will that code compile without letters in the identifier name?Another way to do it is to use the %c tag:-You can add the char as a code point to a StringBuilder:- Or simply print the char:-
One thing to note, though. The question was "How can I print?".
You can encode any Unicode character using techniques described above. Java Strings are always Unicode. But to print them you need 2 additional requirements met:
1. The output channel (Stream encoding or GUI display) has to be capable of non-translated Unicode output. Or, if you're outputting EBCDIC or something like that, for example, that's still OK, but only providing that the translation provided can also accurately translate the Unicode character of interest.
2. The output media used for "printing" (including GUI or terminal display) is using a font that defines a glyph for that character. If I want to output a Unicode point that defines an ancient Sumerian character, then my font has to have a graphic (glyph) defined that renders that character. Otherwise a default (such as a hollow box character) gets displayed.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
If you're on Windows 10 then using a different terminal window than the standard CMD terminal is very important. In the Java GUI you're generally golden as long as the font supports the glyph (as indicated before). Windows 11 introduced the new Windows terminal which is much more capable than the previous one (it would have been hard to create a less capable one to be honest). You can also get or enable it for Windows 10. On Linux and macOS most terminals default to UTF-8 so no problems expected there.
I'm full of tinier men! And a tiny ad:
Gift giving made easy with the permaculture playing cards