Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to convert char to interger  RSS feed

 
bhaveshs shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,
kindly help me to convert char to interger
as i have declare
int n, i,x;
char a;

x = Integer.parseInt(a) ;

as i have used this code

kindly help me.

bhavesh
 
imran quazi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just do:

int x=0;
char c='a';

x=c;


You can always convert a char, byte or short into an int without explicit casting, because they're widening conversion.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!