• 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