×

Welcome to TagMyCode

Please login or create account to add a snippet.
1
0
 
1
Language: Java
Posted by: Wilmar Giraldo
Added: Mar 26, 2017 1:37 PM
Modified: Mar 26, 2017 1:39 PM
Views: 2322
Tags: console input
  1. import java.io.*;
  2.  
  3. class Hola {
  4.   public static void main( String args[] ) {
  5.     String nombre = "";
  6.  
  7.     System.out.print( "Introduzca su nombre: " );
  8.     try {
  9.       BufferedReader entrada =
  10.         new BufferedReader(new InputStreamReader(System.in));  
  11.       nombre = entrada.readLine();
  12.     }
  13.     catch (IOException e) {}
  14.     System.out.println( "Hola, " + nombre );
  15.   }
  16. }