jimmy
,
Greenhorn
( tags added and corrections made to variable names)
[ November 28, 2004: Message edited by: Barry Gaunt ]
jimmy
,
Greenhorn
sorry,
should be :
System.out.println(" x= " + x + " prefix value=" + resultPre);
System.out.println(" x= " + x + " postfix value=" + resultPost);
and the outprint is :
x=--diamand sign-- prefix value = 5
x=--diamand sign-- postfix value = 4
Barry Gaunt
,
Ranch Hand
That's because variable x is declared as a char. So it tries to print out a representation of whatever unicode character has the value 4 (\u0004).
To get it to print "4" you can cast it to an int as in:
jimmy
,
Greenhorn
oh, I see, thanks alot
I like tacos! And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com