Do catch block have any limitations ?

Someone was arguing me that we can not write 'anything we want' in catch block !! Is it so ? Are there any limitations on the code that we put within catch ?

Replies

  • rahul69
    rahul69
    Alok mishra
    Someone was arguing me that we can not write 'anything we want' in catch block !! Is it so ? Are there any limitations on the code that we put within catch ?
    Ask that someone to be specific ,as "anything we want" may include a lot of things.
    As u cannot write "Anything u want" inside the main() function, it must be a valid code.


    Regarding catch blocks, if u are trying to catch multiple exceptions in a single catch block (Assuming Java 7), u cannot change the catch parameter inside the catch block.
  • Alok mishra
    Alok mishra
    rahul69
    Ask that someone to be specific ,as "anything we want" may include a lot of things.
    As u cannot write "Anything u want" inside the main() function, it must be a valid code.


    Regarding catch blocks, if u are trying to catch multiple exceptions in a single catch block (Assuming Java 7), u cannot change the catch parameter inside the catch block.
    if we write another valid program inside catch that sorts a given array and prints and from try we manually throw an exception then i think catch will successfully sort that array and print .no?

You are reading an archived discussion.

Related Posts

Ashok Leyland has launched it’s all new BOSS range intermediate commercial vehicles today. It’s essentially a Ashok Leyland badged AVIA trucks. Avia is nothing but a Czech truck brand and...
Patexia is hosting a new microprocessor patent study. We are offering a prize pool of $10,000 for qualified submissions. You can view the contest here: https://bit.ly/15YHgaE
I would like to record few videos of the gameplay. Can anyone tell me, how to do it ?
I have some weird fetish for NFC, I believe that all these credit cards, cash & anyother physical payment will be replaced by NFC. Home Automation is even more secure...
Samsung Galaxy Note 3, SM-N9000 pre bookings have begin in India for Rs. 2000. The phone's currently listed on SamsungIndiaEstore is soon expected to make it to leading online retailers....