Caro Cláudio,
 
Você pode utilizar esta classe Entrada que eu tenho....
 
class Entrada
{
  public double Numero(String Legenda)throws IOException
  {
    StreamTokenizer in=new StreamTokenizer(System.in);
    System.out.print(Legenda);
    do
      in.nextToken();
      while(in.ttype!=StreamTokenizer.TT_NUMBER);
      return(in.nval);
  }
  public String String(String Legenda)throws IOException
  {
    StreamTokenizer in=new StreamTokenizer(System.in);
    System.out.print(Legenda);
    do
      in.nextToken();
      while(in.ttype!=StreamTokenizer.TT_WORD);
      return(in.sval);
  }
}
Para utilizar esta classe não esqueça o type cast, blz?
Ex.:
class Exemplo{
    Entrada ler = new Entrada();
    int variavel = (int)ler.Numero("Entre com o número desejado");
}
 
Qualquer dúvida mande outro e-mail...
Falow
Rafael Demétrio Benvenutti - Instituto Curitiba de Informática

Responder a