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
>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to