Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 So what am I doing wrong?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kenster102.5




PostPosted: 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);
                       
  }
 
}
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: 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.
riveryu




PostPosted: 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.*".
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: