Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - On the input function of JAVA
On the input function of JAVA
Import java.util.scanner; //Import the Scanner class and use it to receive input characters or strings.

Public class ScannerTest {

Public static void main(String[] args) {

// TODO automatically generates method stubs

Scanner reader = new scanner (system. in); //Construct a scanner

System.out.print ("Enter any character:");

string s = reader . nextline(); //get the input character and assign it to the string variable s.

System.out.println ("The character you entered is"+s ");

}

}