package br.org.senacagil;

import java.util.NoSuchElementException;
import java.util.Scanner;

public class Teclado {
	/**
	 * Lę um texto do usuário.
	 * 
	 * @return
	 */
	public String ler() {
		String texto = null;
		// imprime um 'prompt'
		System.out.print("[TECLADO]>");
		try {
			Scanner sc = new Scanner(System.in);
			texto = sc.next();
		} catch ( NoSuchElementException e) {
			System.out.println("no more tokens are available !");
			e.printStackTrace();
		} catch ( IllegalStateException e) {
			System.out.println("scanner is closed !");
			e.printStackTrace();
		}
		return texto;
	}
}
