UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

I want to rethrow an exception, is that possible?

Asked by Last Modified  

12 Answers

Learn Java

Follow 1
Answer

Please enter your answer

Professional Tutor with 15 years of experience.

yes we can
Comments

Trainer

If you develop your own library which makes use of a third-party library that throws an exception. Now there are two options for us: 1. don't catch it (not a better option) 2. catch it and log it somewhere, then rethrow it By rethrowing, we propgate this exception to the caller (client) of your...
read more
If you develop your own library which makes use of a third-party library that throws an exception. Now there are two options for us: 1. don't catch it (not a better option) 2. catch it and log it somewhere, then rethrow it By rethrowing, we propgate this exception to the caller (client) of your library and request it to catch the excpetion. This way your delegating the responsibility of handling this excpetion to the caller of our library read less
Comments

A software veteran with more than decade of experience

yes...you can use catch(Exception ex) { {some logic} throw ex; }
Comments

Java Tutor

yes...you can using catch block with appropriate Exception argument
Comments

Trainer

Yes, When you catch an exception, it's possible to rethrow it. This is just the same as if you hadn't caught it in the first place - the exception will continue to bubble up through the layers until it reaches some other code that catches it (or it reaches the top of the stack and the program exits)....
read more
Yes, When you catch an exception, it's possible to rethrow it. This is just the same as if you hadn't caught it in the first place - the exception will continue to bubble up through the layers until it reaches some other code that catches it (or it reaches the top of the stack and the program exits). So why would you do this? Well, it means you have temporary access to the exception at the point where you caught it. One situation I've used this in is where I want to log the fact that an error has occurred, but the real error handling is happening at a higher level. You'd only do this, though, if this local logging could add something useful that the higher level error handling doesn't know about. read less
Comments

Java Technical Leader

try { } catch(Exception ex) { }
Comments

Java Technical Leader

try { // code here } catch(Exception ex) { throw ex; } but this is not advisable hust catch the same exception and re-throw it. If you want to make your application specific message then you can try this.
Comments

Talent with Professional Experience

Yes you can rethrow an exception by throwing an exception inside catch block provided we are able to catch the Exception properly. If we are not sure what kind of Exception is caught; in that case we can catch the super Excepiton class incatch block and then throw any other exception
Comments

Java Web Application Development and Aptitude Trainer

yes you can.
Comments

Software Development Trainer

What do you mean by rethrow? Are you trying to ask if one can raise the exception again once it's handled in catch? If yes, then yeah we can. We need to use throw keyword. Something like this try{ //code } catch (exception ex) { //log the exception or do whatever you want. throw...
read more
What do you mean by rethrow? Are you trying to ask if one can raise the exception again once it's handled in catch? If yes, then yeah we can. We need to use throw keyword. Something like this try{ //code } catch (exception ex) { //log the exception or do whatever you want. throw ex;//rethrow exception } read less
Comments

View 10 more Answers

Related Questions

Is it good to go for a Java coaching center and learn Java (with advanced Java) to improve my programming skills?
yes, Please check the Institute reviews and discuss with the tutor, what topics were covered in class. Ask about the practicals session and how many hours/duration of the course.
Gerda
0 0
5
Can we use pointer in java?
No, we can't. Java has reference variables which contains address of objects. The reference variables are substitute to pointers in java. But, we cannot perform mathematical operations on reference variables...
Manish
Where advanced java can be utilized?
Advanced Java is an extension of Java used for developing and running enterprise software and large-scale multi-tiered, scalable, reliable and secure network applications.
Nish
Write a programme to replace the string without using replace command? This is my string. ..... s is replaced by th output is Thith ith my thtring
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package logic; ...
Mithun

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Recommended Articles

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more