0
try{
   if((Boolean)ppb.getParameters().get("abc")){
     Sysout.print("if true it goes inside else continue the code below");
    }
     System.out.print("if classcastexception print this")
 }catch{
    System.out.print("classcastexception but neverprint out");
 }

When I start the debug mode(Eclipse), the code keep running well, even there is a try catch block, but never go inside the block. But when I use CNTRL-SHIFT-I to check the value of (Boolean)ppb.getParameters().get("abc"), it says "ClassCastException".

So here are my questions:

  1. When the value of ppb.getParameters().get("abc") is a String type, casting it to Boolean throws a exception. But why does it keep running? Why does it never go into the try catch block?

  2. Since it running well without interruption, should I handle this exception or not?

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Hello, welcome to StackOverflow. You should edit your post to add the tag of the programming language you're using. This will help people to find your question. – Vincent Saulue-Laborde Jun 29 '18 at 12:37
  • And please (next time!) try to use proper spelling, punctuation and spelling, and try to use correct Markdown to format your questions to be readable. I have fixed ... the mess. – Stephen C Jun 30 '18 at 01:04

0 Answers0