JAva and Project builder

jsn

Registered
hi

I wrote a java program with project builder and whenI run it this line does not work inChar = System.in.read();

It looks like I can write but i can not read why ?

here is the program :

//
// ReadHello.java
//

import java.io.*;

public class ReadHello {

public static void main(String args[]) {
int inChar;
System.out.println("Enter a character");


try {
inChar = System.in.read();
System.out.print("You entered:");
System.out.println(inChar);
}
catch (IOException e) {
System.out.println("error reading from user");
}
}

}

thanks
jsn
 
After you enter the character, you have to hit return. System.in.whatever is buffered and waits for a line at a time.

BTW your code worked for me from the command line on Win NT.

-Rob
 
Back
Top