This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assigning to char Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assigning to char" Watch "Assigning to char" New topic

Assigning to char

Guy Belpa
Ranch Hand

Joined: Nov 21, 2004
Posts: 41
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

Joined: Oct 11, 2004
Posts: 3830
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

Joined: Aug 31, 2004
Posts: 11343


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Assigning to char
It's not a secret anymore!