import java.io.*;
public class Input {
static BufferedReader input= new BufferedReader(new InputStreamReader(System.in)) ;
public byte getByte(){
byte value=0;
try{
value= Byte.parseByte(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public String getString() throws Exception{
String str= "";
str= input.readLine();
return str;
}
public int getInt(){
int value=0;
try{
value= Integer.parseInt(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public float getFloat(){
float value=0;
try{
value= Float.parseFloat(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public short getShort(){
short value=0;
try{
value= Short.parseShort(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public long getLong(){
long value=0;
try{
value= Long.parseLong(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public double getDouble(){
double value=0;
try{
value= Double.parseDouble(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public boolean getBoolean(){
boolean value=false;
try{
value= Boolean.parseBoolean(input.readLine());
} catch(Exception e){
System.out.println("Error: "+ e.getMessage());
}
return value;
}
public char getCharacter() throws Exception {
char chr= '\u0000';
chr= input.readLine().charAt(0);
return chr;
}
}
Walang komento:
Mag-post ng isang Komento