castear string a int java code example Example: string a int java String number = "1" int num = Integer.parseInt (name); //num equals 1