UrbanPro

Learn Java Training from the Best Tutors

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

Search in

What are the different types of Exceptions in Java?

Asked by Last Modified  

10 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Computer Application

Null pointer exception ArrayOutOfIndex exception DivideByZero exception
Comments

Software Developer And Trainer

compile time exception and run time exception
Comments

Exception is an abnormal condition or error that arises during an application processing at run time. The parent class is the Throwable class which has two direct subclasses, java.lang.Error and java.lang.Exception. custom exception that extends the Exception class. The JVM takes care of throwing...
read more
Exception is an abnormal condition or error that arises during an application processing at run time. The parent class is the Throwable class which has two direct subclasses, java.lang.Error and java.lang.Exception. custom exception that extends the Exception class. The JVM takes care of throwing an instance of Error object when there is a system error. The proper Exception handling useful in tracking and debugging errors in the application and sub systems. All the exceptions, which are caught and handled within the calling method or declared in the throws clause of the method, are categorized under checked exceptions. All the checked exceptions must be a sub class of java.lang. Exception class. The JVM will verify that all the checked exceptions are taken care properly by the calling method in the class. Unchecked Exceptions The exception which are raised because of incorrect logic or programming errors are categorized as Unchecked exceptions. These exceptions are sub classes of RunTimeException class. The JVM will not verify for these exceptions in the calling method read less
Comments

1) Checked Exception The classes that extend Throwable class except RuntimeException and Error are known as checked exceptions e.g.IOException, SQLException etc. Checked exceptions are checked at compile-time. 2) Unchecked Exception The classes that extend RuntimeException are known as unchecked exceptions...
read more
1) Checked Exception The classes that extend Throwable class except RuntimeException and Error are known as checked exceptions e.g.IOException, SQLException etc. Checked exceptions are checked at compile-time. 2) Unchecked Exception The classes that extend RuntimeException are known as unchecked exceptions e.g. ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException etc. Unchecked exceptions are not checked at compile-time rather they are checked at runtime. 3) Error Error is irrecoverable e.g. OutOfMemoryError, VirtualMachineError, AssertionError etc. read less
Comments

Java,adv java,hibernate,spring

2 types of exceptions exception and error inside exception compile time exception(checked exception) and run time exception(unchecked exception)
Comments

Trainer

Main two types 1. Compile time exception ex: FileNotFound Exception,ClassNotFound Exception. 2. Run time exception ex: ArrayIndexOutOfBounds Exception,IllegalTypeException,NullPointer exception,Arithmetic exception. also called Checked exceptions and Unchecked exceptions.
Comments

Java/J2EE Expert & Data Analytic

An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore these exceptions are to be handled. An exception...
read more
An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore these exceptions are to be handled. An exception can occur for many different reasons, below given are some scenarios where exception occurs. A user has entered invalid data. A file that needs to be opened cannot be found. A network connection has been lost in the middle of communications or the JVM has run out of memory. Some of these exceptions are caused by user error, others by programmer error, and others by physical resources that have failed in some manner. Based on these we have three categories of Exceptions you need to understand them to know how exception handling works in Java, Checked exceptions: A checked exception is an exception that occurs at the compile time, these are also called as compile time exceptions. These exceptions cannot simply be ignored at the time of compilation, the Programmer should take care of (handle) these exceptions. For example, if you use FileReader class in your program to read data from a file, if the file specified in its constructor doesn't exist, then an FileNotFoundException occurs, and compiler prompts the programmer to handle the exception. import java.io.File; import java.io.FileReader; public class FilenotFound_Demo { public static void main(String args[]){ File file=new File("E://file.txt"); FileReader fr=new FileReader(file); } } If you try to compile the above program you will get exceptions as shown below. C:\>javac FilenotFound_Demo.java FilenotFound_Demo.java:8: error: unreported exception FileNotFoundException; must be caught or declared to be thrown FileReader fr = new FileReader(file); ^ 1 error Note: Since the methods read() and close() of FileReader class throws IOException, you can observe that compiler notifies to handle IOException, along with FileNotFoundException. Unchecked exceptions: An Unchecked exception is an exception that occurs at the time of execution, these are also called as Runtime Exceptions, these include programming bugs, such as logic errors or improper use of an API. runtime exceptions are ignored at the time of compilation. For example, if you have declared an array of size 5 in your program, and trying to call the 6th element of the array then an ArrayIndexOutOfBoundsExceptionexception occurs. public class Unchecked_Demo { public static void main(String args[]){ int num[]={1,2,3,4}; System.out.println(num[5]); } } If you compile and execute the above program you will get exception as shown below. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Exceptions.Unchecked_Demo.main(Unchecked_Demo.java:8) Errors: These are not exceptions at all, but problems that arise beyond the control of the user or the programmer. Errors are typically ignored in your code because you can rarely do anything about an error. For example, if a stack overflow occurs, an error will arise. They are also ignored at the time of compilation. read less
Comments

Tutor

you can say runtime and compile time, checked and uncheked exceptions.
Comments

Checked Exceptions and Unchecked exceptions
Comments

Teacher

Exceptions are 2 types. 1.Checked 2.Uncheked All the exception for that compiler doesn't care are comes under unchecked exception i.e. ArithmaticException, ArrayIndexOutofBoundexp etc Exceptions which needs to be defined in throws clause of a method r checked exception,ie.sevletException,ClassNotFoundExp,NoSuchFieldException...
read more
Exceptions are 2 types. 1.Checked 2.Uncheked All the exception for that compiler doesn't care are comes under unchecked exception i.e. ArithmaticException, ArrayIndexOutofBoundexp etc Exceptions which needs to be defined in throws clause of a method r checked exception,ie.sevletException,ClassNotFoundExp,NoSuchFieldException etc read less
Comments

View 8 more Answers

Related Questions

Should I learn a Python course online or offline? What are some good Python training classes?
If it is that much simple as i have been said to learn from the internet then everyone would have been developer according to me you should learn offline by some good institute. like Praxware technologies...
Neha
0 0
8
I know HTML, CSS, and a bit of JavaScript. What should I learn next?
HTML,CSS and Javascript are Tools which are used for Front-End Web Development. The next step is to learn the following: 1)Learn Javascript Frameworks like node.js,react.js,angular.js etc. 2)Learn Back-End...
Inch By
Hi , this is Mithun Ghosh from Kolkata. I want a suggestion about the course content of teaching Java starting from core to Advanced level. Please anyone do help with a legible course content. Thanks in advance -- Thanks & Regards, Mithun Ghosh
Hi Mithun, This is AkiraITSolutions, We do provide real time training with real time employees, who ever having more than 10 years of IT Experience. For further details please feel free to reach us.
Mithun Ghosh
Can a class have interface and vice-versa?
how its possible both has different meaning you cant enclosed it
Deepa
0 0
7

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

Ask a Question

Related Lessons

Hibernate 5
The Hibernate team published the first Hibernate 5 release quite a while ago, and since then they introduced a bunch of new features. I explained several of them here on the blog, and it’s about...
M

Mohammed Shahnawaz Akhter

2 0
0

Class and Objects in Java
Class is a template or a blueprint which is used to describe an object. On other hand Object is a reference of a class which follows all the stuff written inside the class. How about taking the whole tour in the following video

Java Program Sample Application
/* WAP to print given message on the console using java*/ // Class declaration in java class sample { // Main function public static void main(String args) { // function for printing on the console System.out.println("Hello...
S

Inheritance In Java
Inheritance: The process of getting properties and behaviors from one class to another class is called inheritance. Properties: Variables Behaviors: Methods The main purpose of the inheritance...
D

Deleted U.

1 0
0

What Are IT Industries Performance Metrics?
1. Outstanding Expectation: Eligible to get Promotion easily and good salary hike. Always preferrable to go abroad. 2. Exceed Expectation: Can get Promotion as per schedule of company with good salary...

Recommended Articles

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 >

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 >

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

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 >

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