Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2006

Tip: Looking for answers? Try searching our database.

Newbie question on identifiers for basic catch statements

Thread view: 
akh2103@gmail.com - 18 Sep 2006 16:42 GMT
Hello--I am new to Java and having trouble with the identifiers that
are expected in catch statments. My compiler is telling me that it
doesn't recognize the symbols that I give in catch statements, but I
can't find a site online that explains how the identiers work. I am
trying to do really basic stuff ex.
Try{
do stuff
}
Catch (Some Exception Identifier){
do other stuff
}

but again, I can't get the compiler to take all of the identifiers that
I give. I know the identifiers must come from the inherited class, but
that isn't helping me much.

The error that the compiler gives looks like this
Program6.java:25: cannot find symbol
symbol  : class InputMismatchException
location: class QuestionTwoShot
               } catch (InputMismatchException e) {
                        ^
1 error

Any help (or even better, explanation) would be much appreciated.
Thanks.
Knute Johnson - 18 Sep 2006 17:08 GMT
> Hello--I am new to Java and having trouble with the identifiers that
> are expected in catch statments. My compiler is telling me that it
[quoted text clipped - 22 lines]
> Any help (or even better, explanation) would be much appreciated.
> Thanks.

InputMismatchException is in the java.util package.  Did you import
java.util?

Signature

Knute Johnson
email s/nospam/knute/

Ralf Seitner - 18 Sep 2006 17:16 GMT
[...]
> The error that the compiler gives looks like this
> Program6.java:25: cannot find symbol
[quoted text clipped - 3 lines]
>                          ^
> 1 error
Hi!
You didnt import the class, so the compiler doesnt know where to find it.
Import it with "import java.util.ImportMismatchException"

Example:

import java.util.ImportMismatchException;
public class QuestionTwoShot {
...
}

bye, Ralf


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.