u should use the concept of wrapper classes to solve ur problem. OPTION 1 Integer intobj1 = Integer.valueof("C"); //will convert the string "C" into Integer class int i = intobj1.intvalue(); // will give the int value OPTION 2 int i = Integer.parseInt("C"); // but this can generate NumberFormatException so put it in a try and catch block. then u can print the value of i java being a case sensitive language, 'c' cannot be equal to 'C'
shweta agarwal Sun Certified Programmer for the Java� 2 Platform
Joined: Jan 25, 2001
shweta agarwal - ur solution didnt work cause it gives me number format exception (Option 1)