Yes, a specific exception should be written first, wider after that,
As you call all animals first in the room, and after you try to see if there is any person outside
for example
try{ //do something }catch(Exception ex){ }catch(NullPointerException npe){ }
Gives you a compile time error
Jigar joshi
source share