File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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

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

Azuritul Wu

Joined: Apr 21, 2004
Posts: 8

In my program I write:


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?

Abhinay Verma

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

Joined: Apr 21, 2004
Posts: 8
Many thanks for your reply...
I agree. Here's the link:
subject: System.out.println((char)-1) printing question mark
It's not a secret anymore!