import java.io.*;

/** tentando achar um jeito comodo de fazer leituram em java */
class Leitura {
  /** leitura de double */
  static double leDouble() 
       throws IOException
  {
    StreamTokenizer in = new StreamTokenizer(System.in);
    
    while (in.nextToken() != StreamTokenizer.TT_EOF) 
      if (in.ttype == StreamTokenizer.TT_NUMBER)
	return(in.nval);
    throw new IOException("Nao conseguiu ler double");
  }  

  /** leitura de inteiro */
  static int leInt()
       throws IOException
  {
    StreamTokenizer in = new StreamTokenizer(System.in);
    
    while (in.nextToken() != StreamTokenizer.TT_EOF) 
      if (in.ttype == StreamTokenizer.TT_NUMBER)
	return((int) in.nval);
    throw new IOException("Nao conseguiu ler int");
  }

  /** leitura de char */
  static char leChar()
       throws IOException
  {
    try {
      InputStream in = System.in;
      byte[] buf = new byte[1];
      in.read(buf, 0, 1);
      return((char)buf[0]);
    }
    catch (IOException e) {
      throw new IOException("Nao conseguiu ler char");
    }
  }

  public static void main (String[] args)
  {
  
    System.out.println("Stream de entrada aberta\n");
    
    try {
      double d;
      System.out.println("Entre com double a ser lido:");      
      d = leDouble();
      System.out.println("Double devolvido e'" + d);      
      System.out.println("Entre com inteiro a ser lido:");      
      int i = leInt();
      System.out.println("int devolvido e'" + i);      
      System.out.println("Entre com o char a ser lido:");      
      char c = leChar();
      System.out.println("char devolvido e'" + c);      
    }
    catch  (IOException e) {
      System.out.println(e);
    }
    finally {
      System.out.println("Terminada a execucao");
    }
  }
}

      

   
