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

What is the best book to learn data structures using Java?
There are several excellent books that can help you learn data structures using Java. 1. "Data Structures and Algorithms in Java" by Robert Lafore. 2. "Algorithms, Part I" by Robert Sedgewick and Kevin...
Shubham
0 0
5
Is JAVA training only for technical students or a non-technical student also may join?
Any Body can Learn Programming Language.It All depends upon the learning of basics and all.Basics actually makes the thing different.
Vikrant
0 0
6
Is Java a compiler or Interpreter?
Java is a programming language and computing platform first released by Sun Microsystems in 1995. A Java compiler is a compiler for the Java programming language. A JVM interprets bytecode and...
Dr Rakesh

Hi every one i have done my I com so plzz suggest me it course. I want do carrer in it field

First of all you should take the degree course with full concept because when you have chosen this subject then you will haveto try for best performance in it
Aquib
0 0
9

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

Ask a Question

Related Lessons

Introduction to Course Content
Video about what we are going to learn throughout the Java Training Session .

Features Of Java
There is given many features of java. They are also known as java buzzwords. The Java Features given below are simple and easy to understand. i. Simple ii. Object-Oriented iii. Portable iv. Platform...

Write your first Python program in 10 minutes
1. Download python from python official site search "python download" in google 2. Install in your machine 3. verify using : "python --version" command 4. Write first program using notepad create...

Core Java
Introduction: An Object Oriented Programming Language consists of Objects. There are object oriented programming languages like Smalltalk, C++. Each and every OOP language has some underlying disadvantages....

Overview on Auto IT and use in selenium webdriver
AutoIt v3 is a freeware BASIC-like scripting languages designed for automating the windows GUI and general scripting. It used a combination of simulated keystrokes, mouse movements and window/control manipulation...
S

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