This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
char c = 'b'-'a' --No Compile error??????????
the argument of method mark() does not work
urgent ..please look at code
FileConnection
why is char doing strange things?