Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assigning to char

 
Guy Belpa
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is legal to assign a number literal (octal ,decimal ,hexdecimal)
(0-65535) to char.Isn't it? so what are they take as their character?
Is it unicode number?
If char=017; char=17; char=ox11;
Are a,b,c take same character?
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Yes you can assign a number to char .
char c = 97;
since 97 is ascii value of a , when you print it with SOP it will print a .
try it .
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://www.asciitable.com/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic