954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

stdin.readlin() doesn't want to work ?

Well I got the whole substring thing working.. thanks a lot. Now I've gotta struggle with the "stdin.readline()" which doesn't wanna work for some odd reason :P I imported the java.io.* i created a new BufferedReader ... and it just doesn't wanna work.

Are there any other ways of getting input from a user. In c++ it was just CIN and that WAS SOOOO MUCH EASIER than screwing around with all of these buffered readers :P

Any ideas?

Rentro
Newbie Poster
6 posts since Oct 2004
Reputation Points: 10
Solved Threads: 0
 

It would have helped to have the code posted but I'll post some code with the bufferedReader that does work to hopefully help you...

import java.io.*;

class Poop
{
	public static void main(String[] args) throws IOException 
	{
	  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	  String inData;
	  int count = 0;
	  
	  do
	  {
	    
	    System.out.println("Enter some text");
	    inData = br.readLine();
	    count++;
	}
	

	while  (!inData.equals(""));
		System.out.println("You were promted: " + count + " times");
	
        }
}
}
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

What version of Java are you using? 1.4.2 0r 1.5.0

Jeremy

simpsonjr
Newbie Poster
6 posts since Oct 2004
Reputation Points: 11
Solved Threads: 0
 

What version of Java are you using? 1.4.2 0r 1.5.0

Jeremy

As he stated above it might be the sdk your using. If your using an older version like me you will use the BufferedReader. If you use sdk 1.5 they got some Scanner() method or something in place of the BufferedReader.

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You