Hi,
Why below code is giving compilation error at catch statement
try{
// some of my codes
}catch(IOException|SQLException ex){
ex.printStackTrace();
}
I am getting below compilation error
IOException.SQLException cannot be resolved to a type
- Syntax error on token "|", . expected
As per the API we can have multiple exception handling in one catch.
Catching More Than One Exception in One Catch Block
Moderator: admin
-
- Posts: 27
- Joined: Thu Feb 07, 2013 9:46 pm
- Contact:
-
- Site Admin
- Posts: 10068
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: Catching More Than One Exception in One Catch Block
Are you sure you are using Jdk7 to compile?
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 243 guests