Try block and catch block (java)

Asked By 0 points N/A Posted on -
qa-featured

Hi

I am a java developer.

Just i want to ask you is it necessary that each try block must be followed by a catch block.

Thanks in advance

SHARE
Best Answer by Tunacao_Caaron1
Best Answer
Best Answer
Answered By 20 points N/A #102846

Try block and catch block (java)

qa-featured

Hey Archie!

The question you ask about Try Block and catch Block has really a simple and easy answer.

Here is your answer.

Well it is not necessary each catch block must come after each Try block. But there is a compulsion that each Try blocks must followed by a catch of Finally Block. And all other expectations which are about to be thrown, must be declared in the "throws clause of method. Anyways you can either arrange the Try Block first, or Catch box first, it does not make a difference and is not necessary at all.

Thanks

Tunacao Caaron.

Answered By 0 points N/A #102847

Try block and catch block (java)

qa-featured

Hi ,

You are a java developer. So i think you understand me without problem.

I inform you that java use five keywords ; try,catch,throw,throws,finally .

In this language you ought to follow the rule of exception handling in java.

This is the most reliable way in my thinking .

There is no alternative good way in this language .

Thanks.

Related Questions