
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are unchecked exceptions in Java?
An unchecked exception is the one which 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.
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.
Example
public class Unchecked_Demo { public static void main(String args[]) { int num[] = {1, 2, 3, 4}; System.out.println(num[5]); } }
Output
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Exceptions.Unchecked_Demo.main(Unchecked_Demo.java:8)
- Related Questions & Answers
- Checked vs Unchecked exceptions in Java
- Checked Vs unchecked exceptions in Java programming.
- Are the instances of Exception checked or unchecked exceptions in java?
- What is the difference between checked and unchecked exceptions in Java?
- Checked vs Unchecked Exceptions in C#
- What are checked exceptions in Java?
- What are custom exceptions in Java?
- What are chained exceptions in Java?
- What are number format exceptions in Java?
- What are user-defined exceptions in C#?
- What are the custom exceptions in C#?
- What are the various important exceptions in Selenium?
- Custom exceptions in Java
- What are the rules to follow while using exceptions in java lambda expressions?
- Built-in Exceptions in Java
Advertisements