123456789101112
  1. import java.util.Scanner;
  2. public class ScannerAndKeyboard
  3. {
  4. public static void main(String[] args)
  5. { Scanner s = new Scanner(System.in);
  6. System.out.print( "Enter your name: " );
  7. String name = s.nextLine();
  8. System.out.println( "Hello " + name + "!" );
  9. }
  10. }