From 9cd52ab69846cb919b49da1d8ec948e1ead27204 Mon Sep 17 00:00:00 2001 From: Prem Kagrani Date: Sun, 14 Oct 2018 22:01:28 +0530 Subject: [PATCH] Added a new point on finally keyword! (#18538) A new point about finally keyword is demonstrated with the help of an example. --- .../guide/english/java/finally-keyword/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/src/pages/guide/english/java/finally-keyword/index.md b/client/src/pages/guide/english/java/finally-keyword/index.md index 4c759ee4be..13fc611ee0 100644 --- a/client/src/pages/guide/english/java/finally-keyword/index.md +++ b/client/src/pages/guide/english/java/finally-keyword/index.md @@ -17,3 +17,17 @@ try { // except when System.exit() is called in "try" or "catch" blocks; } ``` + +The finally block does not need the catch block to precede it.There can also be a finally block without the catch block. + +***Example:*** +```java +try { + //Normal code + System.out.println("hello world!"); +} finally { + System.out.println("In finally block"); +} +``` + +The above code works fine even though the catch statement is not used.