NegativeArraySizeException

  • NegativeArraySizeException is thrown when an attempt is made to create an array with a negative size.

  • It is a subclass of RuntimeException, indicating that it's an unchecked exception.

  • It provides two constructors: one with no detail message and another that accepts a custom error message.

  • This exception inherits several methods for handling and providing information about the error, from its superclasses RuntimeException, Throwable, and Object.

public class NegativeArraySizeException extends RuntimeException

Thrown if an application tries to create an array with negative size.

Public Constructor Summary

NegativeArraySizeException()
Constructs a NegativeArraySizeException with no detail message.
NegativeArraySizeException(String s)
Constructs a NegativeArraySizeException with the specified detail message.

Inherited Method Summary

Public Constructors

public NegativeArraySizeException ()

Constructs a NegativeArraySizeException with no detail message.

public NegativeArraySizeException (String s)

Constructs a NegativeArraySizeException with the specified detail message.

Parameters
s the detail message.