Files
freeCodeCamp/guide/arabic/java/finally-keyword/index.md
2018-10-16 21:32:40 +05:30

20 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Finally
localeTitle: أخيرا
---
## أخيرا
وينتهي الجزء الأخير دائمًا عند الخروج من المحاولة. هذا يضمن أن يتم تنفيذ كتلة النهاية حتى في حالة حدوث استثناء غير متوقع. ولكن في النهاية مفيد أكثر من مجرد معالجة الاستثناءات - فهو يسمح للمبرمج بتجنب إزالة رمز التنظيف دون قصد عن طريق العودة أو المتابعة أو الفشل. وضع كود التنظيف في نهاية المطاف هو دائما ممارسة جيدة ، حتى عندما لا يتوقع أي استثناءات.
**_مثال:_**
`try {
// Normal execution path
throw new EmptyStackException();
} catch (ExampleException ee) {
// deal with the ExampleException
} finally {
// This optional section is executed upon termination of any of the try or catch blocks above,
// except when System.exit() is called in "try" or "catch" blocks;
}
`