This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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)