*
The moose likes Beginning Java and the fly likes System.out.println((char)-1) printing question mark Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.out.println((char)-1) printing question mark" Watch "System.out.println((char)-1) printing question mark" New topic
Author

System.out.println((char)-1) printing question mark

Azuritul Wu
Greenhorn

Joined: Apr 21, 2004
Posts: 8
Hello,

In my program I write:

System.out.println((char)-1);

And the console output is ?.....Can anybody tell me why?
Is this because Java don't recognize this character, so just transforms it to ? mark?


Preparing...
Abhinay Verma
Greenhorn

Joined: Dec 13, 2004
Posts: 24
Yes
You are right. If Java doesn't recognize the code, it will print '?'
Azuritul Wu
Greenhorn

Joined: Apr 21, 2004
Posts: 8
Many thanks for your reply...
 
Consider Paul's rocket mass heater.
 
subject: System.out.println((char)-1) printing question mark