+ 2
is printStackTracr() method working or not???
It's not showing anything about in the catch block i.e printStackTrace()... isn't it supposed to print the exception details??? here's the code:- class A { public static void main (String args[]) { try { for(int i=0;i<3;i++) { System.out.println("hello"); Thread.sleep(1000); } } catch(InterruptedException ie) { ie.printStackTrace();} } }
3 Answers
+ 2
thanks that helps me alot
+ 2
thanks it was really helpful
+ 1
but one more question.... if that code not throws any exeception than why we use try/catch.... however if we not use try/catch than it will.show that interrupted exception!! so
.. what exactly happens with InterruptedException exception??... is it get solved within try block? which I think not!!! maybe I am wrong... please tell