Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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


Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert " Watch "convert " New topic
Author

convert

shirsa ray chaudhuri
Greenhorn

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

where char c='a';

is it write
Ravinder Partap
Greenhorn

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;
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: convert