aspose file tools*
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 Spring in Action this week in the Spring 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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: System.out.println((char)-1) printing question mark