/*
* Copyright © 2008 JavaEECoding.com. All rights reserved.
*/
public class StringToIntConverter
{
public static void main(String args[])
{
String str = "598";
//approach 1: to convert String to int
int int1 = Integer.parseInt(str);
System.out.println( "int1 = " + int1 );
//approach 2: to convert String to int
int int2 = Integer.valueOf(str);
System.out.println( "int2 = " + int2 );
}
}
|