try/catch issue - "cannot find symbol - class InputMismatchExeption"

I'm still learning try/catch but from what i've read online and in the class library it looks right...i'm not sure why it won't compile.

try{

do{

System.out.print("Enter command (1-5): ");

selection = scan.nextInt();

if (selection < 1 || selection > 5){

System.out.print("Illegal command number.");

System.out.println("The available commands are:");

System.out.println("\t1. Add new entry to the address book.");

System.out.println("\t2. Delete existing entry from address book entries.");

System.out.println("\t3. Print out all address book entries.");

System.out.println("\t4. Search records for a certain pattern.");

System.out.println("\t5. Quit the Application.");

}

}

while (selection < 1 || selection > 5);

}

//this does not work!!!!!!

catch( InputMismatchException ime ){

System.out.println("Illegal command.");

}

[1597 byte] By [Cymaea] at [2007-11-27 0:12:15]
# 1
Are you missing the import statement for the class, or for java.util.* ?
ChuckBinga at 2007-7-11 21:54:29 > top of Java-index,Java Essentials,Java Programming...
# 2

I have

import.java.io.*;

at the beginning before i declare my class. I'm not sure abotu the second thing you said, could you elaborate?

I'm sorry, I'm still new at java.

edit: yeah, I didn't import java.util.... *hides in shame*

Do i still have to import util.Scanner or will that import automatically when i import util.*

Message was edited by:

Cymae

Cymaea at 2007-7-11 21:54:29 > top of Java-index,Java Essentials,Java Programming...
# 3
It'll automatically work.You can do it either way. Whichever makes you happy.
lethalwirea at 2007-7-11 21:54:29 > top of Java-index,Java Essentials,Java Programming...
# 4
java.util.* will give access to all classes in the package. That's ok for one-off or temporary programs, but for permanent progs and especially where there are a number of classes in the package, it's much more clear what is being used if you import each class incividually.
ChuckBinga at 2007-7-11 21:54:29 > top of Java-index,Java Essentials,Java Programming...
# 5
thanks! much appreciated
Cymaea at 2007-7-11 21:54:29 > top of Java-index,Java Essentials,Java Programming...