You can either scan an entire line:
Scanner s = new Scanner(System.in);
String str = s.nextLine();
Or you can read a single char
, given you know what encoding you’re dealing with:
char c = (char) System.in.read();
More Related Contents:
- android editText is not prints my input given to it
- saving only doubledigit numbers into my attribute
- Make copy of an array
- How to count the number of occurrences of an element in a List
- How to switch to the new browser window, which opens after click on the button?
- Why can Java Collections not directly store Primitives types?
- When should I use the “strictfp” keyword in java?
- How can I create 2 separate log files with one log4j config file?
- Should private helper methods be static if they can be static
- How to save parsed and changed DOM document in xml file?
- What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?
- How to set JVM parameters for Junit Unit Tests?
- CubicCurve2D connecting two JInternalFrame instances
- String.replaceAll without RegEx
- Java – Access is denied java.io.FileNotFoundException [duplicate]
- concatenating string and numbers Java
- ListView Viewholder checkbox state
- Why does type-promotion take precedence over varargs for overloaded methods
- Combo-box key value pair in JavaFX 2
- Must issue a STARTTLS command first. Sending email with Java and Google Apps
- Java Inheritance – calling superclass method
- SERVER_ERROR: [code] 1675030 [message]: Error performing query
- Hibernate persist entity without fetching association object. just by id
- HashSet contains duplicate entries
- JPA Criteria API with multiple parameters
- How to send and receive serialized object in socket channel
- Sorting two arrays simultaneously
- Where to get “UTF-8” string literal in Java?
- getting result set into DTO with native SQL Query in Hibernate
- Java – How to visually center a specific string (not just a font) in a rectangle