import java.io.*; public class Leer { public String getString() { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader (isr); String s=""; try { s = br.readLine(); } catch(Exception ex) { System.out.println(ex.getMessage()); } return s; } public int getInt() { String s; int valInt=0; s=this.getString(); try { valInt = Integer.parseInt(s); } catch(Exception ex) { System.out.println(ex.getMessage()); } return valInt; } public double getDouble() { String s; double aDub=0.0; s=this.getString(); try { aDub = Double.parseDouble(s); } catch(Exception ex) { System.out.println(ex.getMessage()); } return aDub; } public char getChar() { String s; s=""; try { s = this.getString(); } catch(Exception ex) { System.out.println(ex.getMessage()); } return s.charAt(0); } public char getCharMay() { String s; s=""; try { s = this.getString(); } catch(Exception ex) { System.out.println(ex.getMessage()); } s = s.toUpperCase(); return s.charAt(0); } public String getTextMay() { String s; s=""; try { s = this.getString(); } catch(Exception ex) { System.out.println(ex.getMessage()); } s = s.toUpperCase(); return s; } }
Muestra contenido relacionado a la Programación Orientado a Objeto con el lenguaje de programación Java
sábado, 10 de octubre de 2015
CLASE LEER
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario