Estou criando uma classe chamada “Leitura”.
Só que está dando erro no tipo “short”.
“possible loss of precision”
Alguém tem idéia???
[],
Odair.
Segue o codigo que estou construindo:
import java.io.*;
public class Leitura
{
private BufferedReader ent= new BufferedReader(new InputStreamReader(System.in));
private String texto=null;
public String leString()
{
try{
texto=ent.readLine();
return texto;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return null;
}
}
public int leInt()
{
int varint=0;
try{
texto=ent.readLine();
varint=Integer.valueOf(texto).intValue();
return varint;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return 0;
}
}
public short leShort()
{
int varshort=0;
try{
texto=ent.readLine();
varshort=Short.valueOf(texto).shortValue();
return varshort;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return 0;
}
}
public float leFloat()
{
float varfloat=0f;
try{
texto=ent.readLine();
varfloat=Float.valueOf(texto).floatValue();
return varfloat;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return 0;
}
}
public long leLong()
{
long varlong=0L;
try{
texto=ent.readLine();
varlong=Long.valueOf(texto).longValue();
return varlong;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return 0;
}
}
public double leDouble()
{
double vardouble=0D;
try{
texto=ent.readLine();
vardouble=Double.valueOf(texto).doubleValue();
return vardouble;
}
catch (IOException e) {
System.out.println("Ocorreu um erro do tipo "+e.toString());
return 0;
}
}
}