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 place a block with a command block pe?

To place a block using a command block in Minecraft Pocket Edition (PE), first, obtain a command block by typing /give @p command_block in the chat. Then, place the command block in your world and tap on it to open its interface. Enter the command /setblock <x> <y> <z> <block> where <x> <y> <z> are the coordinates where you want the block to be placed, and <block> is the type of block you want to place. Finally, activate the command block using redstone or a button to execute the command and place the 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 you synchronize source and carrier signals using simulink?

To synchronize source and carrier signals in Simulink, you can use a phase-locked loop (PLL) block or a synchronization block such as the "Symbol Synchronizer" or "Phase Synchronizer." First, generate the source signal and the carrier signal, then feed both into the synchronization block. The block will adjust the phase and frequency of the carrier signal to match the source signal, ensuring proper alignment. Finally, you can visualize the output using a Scope block to confirm synchronization.


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.


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


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.