ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

If you are handling an exception and you included( finally {} ) block code, can u run this this code without execution of finally block code?

user-image
تم إضافة السؤال من قبل himanshu mittal
تاريخ النشر: 2013/06/27
swaminath c
من قبل swaminath c

Yes By placing System.exit() at end of the try block and in catch block

Javed Khan
من قبل Javed Khan , Senior Programmer Analyst , Barclays Technology

Yes using System.exit() before the control goes to the finally block.

Kishori Kumar
من قبل Kishori Kumar

System.exit() is the only way to achieve the specified requirement.

Ashok Yadav
من قبل Ashok Yadav , trainee , S.O Infotech Pvt. Ltd.

system.exit is the only statement that can stop finally block to run

try

{

}

catch(exception e)

{

Syestem.exit();

}

finally()

{}

 

Daanish Rumani
من قبل Daanish Rumani , Product Manager , Publicis Sapient

No.
The finally block is run in all cases even if there has been an exception or the function had a return statement mid way in the function.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟