Created
November 26, 2009 13:50
-
-
Save tedheich/243470 to your computer and use it in GitHub Desktop.
Code to accept keyboard input in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.InputStreamReader; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
class AcceptInputFromKB { | |
public static void main(String []args) throws IOException { | |
InputStreamReader isr = new InputStreamReader (System.in); | |
BufferedReader br = new BufferedReader (isr); | |
System.out.print("% "); | |
String temp = br.readLine(); | |
System.out.println(temp); | |
System.out.println("Length of string = " + temp.length()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment