String to int Conversion

int age = Integer.parseInt( str )

import java.util.Scanner;


public class TestProgram
{
   
    public static void main() {
        
        Scanner in = new Scanner(System.in);
		String str;
		int age;
		
		System.out.print("How old are you? ");
		str = in.nextLine();
		
		age = Integer.parseInt(str);
		
		System.out.printf("You are %d years old\n", age);
    }
}