• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Checked / Unchecked Exceptions List - Java

 
Greenhorn
Posts: 1
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Just a post with the list of Checked/Unchecked exceptions through java documentation

Unchecked Exceptions

ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException
Thrown to indicate that an array has been accessed with an illegal index.
The index is either negative or greater than or equal to the size of the array
Direct Known Subclasses:
ArrayIndexOutOfBoundsException, StringIndexOutOfBoundsException

ClassCastException extends RuntimeException
Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:
Object x = new Integer(0);
System.out.println((String)x)

IllegalArgumentException extends RuntimeException
Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Direct Known Subclasses:
IllegalChannelGroupException, IllegalCharsetNameException, IllegalFormatException, IllegalSelectorException, IllegalThreadStateException, InvalidKeyException, InvalidOpenTypeException, InvalidParameterException, InvalidPathException, KeyAlreadyExistsException, NumberFormatException, PatternSyntaxException, ProviderMismatchException, UnresolvedAddressException, UnsupportedAddressTypeException, UnsupportedCharsetException

IllegalStateException extends RuntimeException
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.
Direct Known Subclasses:
AcceptPendingException, AlreadyBoundException, AlreadyConnectedException, CancellationException, CancelledKeyException, ClosedDirectoryStreamException, ClosedFileSystemException, ClosedSelectorException, ClosedWatchServiceException, ConnectionPendingException, FormatterClosedException, IllegalBlockingModeException, IllegalComponentStateException, InvalidDnDOperationException, InvalidMarkException, NoConnectionPendingException, NonReadableChannelException, NonWritableChannelException, NotYetBoundException, NotYetConnectedException, OverlappingFileLockException, ReadPendingException, ShutdownChannelGroupException, WritePendingException


NullPointerException extends RuntimeException
Thrown when an application attempts to use null in a case where an object is required. These include:
- Calling the instance method of a null object.
- Accessing or modifying the field of a null object.
- Taking the length of null as if it were an array.
- Accessing or modifying the slots of null as if it were an array.
- Throwing null as if it were a Throwable value.
Applications should throw instances of this class to indicate other illegal uses of the null object.
NullPointerException objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.

NumberFormatException extends IllegalArgumentException
Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.

AssertionError extends Error
Thrown to indicate that an assertion has failed.
The seven one-argument public constructors provided by this class ensure that the assertion error returned by the invocation:
new AssertionError(expression)
has as its detail message the string conversion of expression (as defined in section 15.18.1.1 of The Java™ Language Specification), regardless of the type of expression.

ExceptionInInitializerError extends LinkageError
Signals that an unexpected exception has occurred in a static initializer.
An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.
As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism.
The "saved throwable object" that may be provided at construction time and accessed via the getException() method is now known as the cause, and may be accessed via the Throwable.getCause() method, as well as the aforementioned "legacy method."

StackOverflowError extends VirtualMachineError
Thrown when a stack overflow occurs because an application recurses too deeply.


NoClassDefFoundError extends LinkageError
Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

Checked Exceptions
IOException extends Exception
Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations.
Direct Known Subclasses:
ChangedCharSetException, CharacterCodingException, CharConversionException, ClosedChannelException, EOFException, FileLockInterruptionException, FileNotFoundException, FilerException, FileSystemException, HttpRetryException, IIOException, InterruptedByTimeoutException, InterruptedIOException, InvalidPropertiesFormatException, JMXProviderException, JMXServerErrorException, MalformedURLException, ObjectStreamException, ProtocolException, RemoteException, SaslException, SocketException, SSLException, SyncFailedException, UnknownHostException, UnknownServiceException, UnsupportedDataTypeException, UnsupportedEncodingException, UserPrincipalNotFoundException, UTFDataFormatException, ZipException

FileNotFoundException extends IOException
Signals that an attempt to open the file denoted by a specified pathname has failed.
This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified path name does not exist. It will also be thrown by these constructors if the file does exist but for some reason is inaccessible, for example when an attempt is made to open a read-only file for writing.

ParseException extends Exception
Signals that an error has been reached unexpectedly while parsing.

ClassNotFoundException extends ReflectiveOperationException
Thrown when an application tries to load in a class through its string name using:
The forName method in class Class.
The findSystemClass method in class ClassLoader .
The loadClass method in class ClassLoader.
but no definition for the class with the specified name could be found.
As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "optional exception that was raised while loading the class" that may be provided at construction time and accessed via the getException() method is now known as the cause, and may be accessed via the Throwable.getCause() method, as well as the aforementioned "legacy method."

CloneNotSupportedException extends Exception
Thrown to indicate that the clone method in class Object has been called to clone an object, but that the object's class does not implement the Cloneable interface.
Applications that override the clone method can also throw this exception to indicate that an object could not or should not be cloned
Direct Known Subclasses:
ServerCloneException

InstantiationException extends ReflectiveOperationException
Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated.
The instantiation can fail for a variety of reasons including but not limited to:
the class object represents an abstract class, an interface, an array class, a primitive type, or void
the class has no nullary constructor

InterruptedException extends Exception
Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. Occasionally a method may wish to test whether the current thread has been interrupted, and if so, to immediately throw this exception. The following code can be used to achieve this effect:
if (Thread.interrupted()) // Clears interrupted status!
throw new InterruptedException();

NoSuchMethodException extends ReflectiveOperationException
Thrown when a particular method cannot be found.

NoSuchFieldException extends ReflectiveOperationException
Signals that the class doesn't have a field of a specified name.

See https://docs.oracle.com/javase/7/docs/api/

Hope this will help you
 
Greenhorn
Posts: 7
Firefox Browser Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for sorting out.
Its really helpful.
 
I didn't say it. I'm just telling you what this tiny ad said.
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic