I had a hunch and went down this trail... I think this is it (the problem, not the solution).
You are trying to System.out.println() the unicode character that is > 255, right?
First, look up System.out - it's a static member variable of System, of type PrintStream.
So then look up PrintStream.println(char x) - it says it behaves like print(char), followed by println().
So then, looked at print(char) - It says "Print a character. The character is
translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method"
So then I looked at write(int) - and it says it writes the byte "as given", and that if you want it encoded into the platform's default character encoding, use print(char) or println(char)...
But the point is, you
don't want it encoded - you want it printed
as is.
So I think what you're looking for is:
for me, that didn't end up displaying anything (it's supposed to be a french lowercase y, with two dots, or "diaeresis", over it). I tried the following, to try printing all the characters "in the neighborhood" of '\u00FF':
One seemed to be a bell, another seemed to be a backspace character... Which sounded to me like the beginning of the ASCII sequence, so I tried it again with the loop going from '\u0000' to '\u000F', and it was nearly (interestingly, it was not exactly) the same sequence of gibberish - dark smiley face, light smiley face, heart, diamond, club, spade...
And then I looked back at that method definition for PrintStream.write(int) again:
write(int) - ...writes the
byte "as given"...
so even though you supply an int, it's going to interpret it (must be an explicit cast) as a byte... which means that after 255, we wrap around to 0. I found in the source for PrintStream that it's calling OutputStream.write(int), which is abstract, but the
doc says:
"The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b.
The 24 high-order bits of b are ignored."
Bottom line, I think you're out of luck trying to use System.out with anything bigger than a byte.
I considered looking into whether there was a way to write to a file instead, without the encoding, etc. And then I realized it was late, and I need to quit stalling, and get back to studying for SCJP, since my voucher expires on the 30th. Good luck from here ;-)
-- Jon