Integer.parseInt(String s); needs concrete variable of type String or a String constant as argument. You can say Integer.parseInt(age); or what ever variable you want to be parsed as int. How ever, also, you are doing the parsing before you are doing the "age" reading and it should be after.
On Jul 13, 2:33 am, Merouen Ballout <[email protected]> wrote: > the problem is here > > BufferedReader dataIn = new BufferedReader(new > InputStreamReader( System.in) ); > > // Prompt a user to enter his/her name > String name = ""; > > System.out.println("Please Enter Your Name:"); > > // Read data into je name variable > try{ > name = dataIn.readLine(); > }catch( IOException e ){ > System.out.println("Error!"); > } > > // Prompt a user to enter his/her age > int age=Integer.parseInt(String); > System.out.println("Please Enter Your Age:"); > > // Read entered data into age variable > try{ > age = dataIn.readLine(); > }catch( IOException e ){ > System.out.println("Error!"); > } > > // Display the name and age > System.out.println("Hello " + name +"!" + " " + "Your age is " > + age); > > On Jul 13, 12:23 am, Mark <[email protected]> wrote: > > > > > Integer.parseInt( string ); > > > On Jul 12, 2009, at 7:17 PM, Merouen Ballout wrote: > > > > in the 1 exercise Getting input from keyboard via BufferedReader > > > class > > > > code -1-15 normally the age is an integer variable, but we choose > > > String , is it possible to modify variable age to int ? > > > > thank you- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
