IllegalAccessException

  • IllegalAccessException is thrown when an application attempts to access a class, field, or method it doesn't have permission to.

  • This exception typically occurs during reflection, when using methods like Class.newInstance(), Field.set(), or Method.invoke().

  • IllegalAccessException is a subclass of ReflectiveOperationException and provides two constructors: one with a detail message and one without.

  • The exception includes methods inherited from Throwable for getting the stack trace, message, and cause of the exception.

public class IllegalAccessException extends ReflectiveOperationException

Public Constructor Summary

IllegalAccessException()
Constructs an IllegalAccessException without a detail message.
IllegalAccessException(String s)
Constructs an IllegalAccessException with a detail message.

Inherited Method Summary

Public Constructors

public IllegalAccessException ()

Constructs an IllegalAccessException without a detail message.

public IllegalAccessException (String s)

Constructs an IllegalAccessException with a detail message.

Parameters
s the detail message.