This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Azuritul Wu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Abhinay Verma
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
You are right. If Java doesn't recognize the code, it will print '?'
 
Azuritul Wu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for your reply...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic