answersLogoWhite

0

What are the types of exception in java?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

Exceptions are of two types: checked exceptions and unchecked exceptions.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the types of exception in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How an exception subclass is created in java explain?

We can create a exception sub class by extending Exception class available in java


What is the purpose of NoMatchException handling method in java?

java exception


Which exception is thrown by the add method of Collection interface in java?

exception


Describe the JAVA throwable class hierarchy and types of exceptions?

In Java there are two main types of Exceptions. * Checked Exceptions - The ones that can be checked & handled in our code. Ex: I/O Exception, SQL Exception etc. In most cases, the compiler itself forces us to catch & handle these exceptions * Un-checked Exceptions - The ones that we cannot & should not handle in our code. Ex. Null Pointer Exception The java.lang.Throwable is the super class of all errors and exceptions in Java. Only objects of this class can be thrown & caught and handled by try-catch blocks. Ex: try { ..... ..... } catch (Exception e){ ... } finally { ... }


What is difference between exception handling in C and Java?

Easy: there is no exception-handling in C.


Which is the base class of exception handling in java?

Thorwable


How do you throw exception in java?

we do it using the throw keyword.


When should we use exception handling in java?

Exception handling should be used in Java in all cases where you as a programmer suspect that your code might throw some exceptions or create errors that might look ugly when a user is using the application. In such cases you use exception handling to catch and handle the exception and exit gracefully. You use the try - catch block in Java for exception handling.


Write the 3 user defined exception in java?

1. Arithmetic Exception 2. Input Output Exception 3. Number Format Exception


What is meant by The Java Software Development Kit?

It is a kit of JAVA development tools that are normally not shipped with JAVA! MOST companies have "Development kits" for their software - Java is not an exception!


What exception thrown by sleep method in java?

InterruptedException is thrown.


Can userdefined exception have two methods in it?

Yes a user defined exception can have any number of methods in it. A user defined exception is nothing but a Java class created for a specific purpose. Just like ordinary Java classes, you can have any number of methods in it...