Computer Science Canada

So what am I doing wrong?

Author:  Kenster102.5 [ Thu Sep 04, 2008 9:50 pm ]
Post subject:  So what am I doing wrong?

I am just trying to create an easy template for me to follow when it comes to inputing names, but since last year I learned Ready To Program, for some reason this year I have to learn Doctor Java, so could somebody kindly just point out what I need to change.
Thanks
Ken

code:
import java.io.*;

public class KenName
{
  public static void main ( String args [])
  {
    String name1;
   
    System.out.println("Who is this? Please enter name");
                        name1 = readLine(); /*This seems to be my problem */
                        System.out.println("This is, " + name1);
                       
  }
 
}

Author:  rdrake [ Thu Sep 04, 2008 10:01 pm ]
Post subject:  Re: So what am I doing wrong?

You're not calling readLine() on an object. You need to make use of a BufferedReader object like this example shows.

Author:  riveryu [ Sun Sep 07, 2008 4:19 pm ]
Post subject:  RE:So what am I doing wrong?

Also, I think you need to label "throws IOException" when you are using something from "java.io.*".


: