answersLogoWhite

0

use of finally block is optional in java.if u want to clean up ur code (means u want to close any connection)after exception handling then go for finally block.if not then also your code will run fine.so finally block is optional in java.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Does try run without catch n exception handling?

A try block must have a corresponding catch or atleast a finally block. The purpose of a try block is to identify areas in the code where exceptions may be generated and handle them. So, if you dont have a catch block, the whole purpose of using the try block is defeated


Can you block blackberry phone?

You can block a Blackberry without a sim card,using the serial number.


Can you print some message on the console without using main in java?

By using the static block


How do you make a sentence using the word can try?

I can try to build a block tower without it toppling over.


Why finally block is used even though statements after catch block are executable with out enclosing them in finally block?

Code in the finally block is executed even if no exception is thrown. That is to say, it is a way to make sure that a second of code always executes regardless of the path taken to reach the end of the try-catch block. The code in the catch block is executed only if there is an exception caught; it is intended to handle the situation that threw the exception. As a trivial example, you might allocate memory, perform some transaction, save the data to a file, then close the file and deallocate memory. It would make sense to put the memory allocation, file allocation, and data processing inside the try block, so you can catch any exceptions, then handle the exceptions in the catch block, and finally deallocate the memory and close the file, if open, using a finally block (to ensure that all resources were released, regardless of the exception handling).


MY NEIGHBORS ARE USING MY WIFI HOW CAN I BLOCK IT FROM THEM?

MY NEIGHBORS ARE USING MY WIFI HOW CAN I BLOCK IT FROM THEM


How can wood edges be rounded without using a router?

Wood edges can be rounded without using a router by using sandpaper to manually sand down the edges until they are smooth and rounded. This can be done by hand or with the help of a sanding block to achieve a rounded edge on the wood.


How can I transfer an image to a lino block for printing?

To transfer an image to a lino block for printing, you can use a technique called "image transfer." First, print or draw your image on a piece of paper. Then, place the paper with the image face down on the lino block and rub the back of the paper with a spoon or a burnisher. This will transfer the image onto the lino block. Finally, you can carve the image into the lino block using carving tools to create your printing block.


How do you draw a triangle without using a compass or ruler?

You can use a protractor! Draw the baseline and measure the angles and mark them. Then finally join them together!


What does difference mean in the word of mathematics?

It's hard to explain without using the word difference, but here's an example: The difference between 5 and 7 is 2. 7 minus 5 = 2


How was block printing used in the middle ages?

Block printing was done by using individual letter 'stamps' to create pages of writing without any need for handwriting. Block printing is the direct predecessor to the pruinting press, which used printing blocks arranged and then (using a wine press) printing pages at a time. The printing press is the predecessor of modern day printers.


What are the differences between using HR Block online versus HR Block software for filing taxes?

The main difference between using HR Block online and HR Block software for filing taxes is the method of access. HR Block online allows you to file your taxes directly through their website, while HR Block software requires you to download and install the program on your computer. Additionally, HR Block online may offer more convenience and accessibility as it can be accessed from any device with an internet connection, while the software version is limited to the computer it is installed on.