The moose likes Beginning Java and the fly likes convert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert " Watch "convert " New topic


shirsa ray chaudhuri

Joined: Apr 08, 2008
Posts: 10
int i=(int)c;

where char c='a';

is it write
Ravinder Partap

Joined: Feb 03, 2008
Posts: 8
this is fine, but you could avoid the explicit casting as its done implecitly while widening 16 bit char to 32 bit int primitive.
int i= (int)c;
is equal to :
int i = c;
I agree. Here's the link:
subject: convert
It's not a secret anymore!