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: 10388
- 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?
Who is online
Users browsing this forum: No registered users and 4 guests