¿como leo variables en java introducidas desde el teclado?
//Es muy simple ..............
import java.io.*;
public class InputExample{
public static void main(String argv[]) throws IOException
{
String nombre,direccion,telefono;
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa tu Nombre:");
nombre = r.readLine();
System.out.println("Ingresa tu direccion:");
direccion = r.readLine();
System.out.println("Ingresa tu telefono");
telefono= r.readLine();
r.readLine();
System.out.println("Tu nombre es:"+nombre);
System.out.println("Direccion:"+direccion);
System.out.println("Telefono:"+telefono);
}
}
import java.io.*;
public class InputExample{
public static void main(String argv[]) throws IOException
{
String nombre,direccion,telefono;
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Ingresa tu Nombre:");
nombre = r.readLine();
System.out.println("Ingresa tu direccion:");
direccion = r.readLine();
System.out.println("Ingresa tu telefono");
telefono= r.readLine();
r.readLine();
System.out.println("Tu nombre es:"+nombre);
System.out.println("Direccion:"+direccion);
System.out.println("Telefono:"+telefono);
}
}
