Apart from regular expressions, parsing Strings as ints and try/catch blocks are there any other ways of handling InputMismatchException & NoSuchElementException with a Scanner?
import java.util.Scanner;
public class TestingScanner
{
public TestingScanner() {
tokenizeLine();
}
public void tokenizeLine() {
Scanner scanner = new Scanner("Paul 56 3125 Actor");
String name = scanner.next();
int age = scanner.nextInt();
int money = scanner.nextInt();
String occupation = scanner.next();
System.out.println(name);
System.out.println(age);
System.out.println(money);
System.out.println(occupation);
scanner.close();
}
}