Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 866405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:47:58+00:00 2026-05-15T09:47:58+00:00

Consider this pair of Throwable : IllegalAccessException extends Exception Thrown when an application tries

  • 0

Consider this pair of Throwable:

IllegalAccessExceptionextends Exception

Thrown when an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, but the currently executing method does not have access to the definition of the specified class, field, method or constructor.

IllegalAccessErrorext IncompatibleClassChangeError ext LinkageError ext Error

Thrown if an application attempts to access or modify a field, or to call a method that it does not have access to.

Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

Questions

  • Can someone give a code example where each is thrown?
  • Does the similarity in name imply relationship between the two, or is it just pure coincidence?
  • Are there other XXXError and XXXException combo? How are the pairs related to each other?
  • If you explicitly try to catch one in an Exception/Error pair, should you also catch the other?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:47:59+00:00Added an answer on May 15, 2026 at 9:47 am

    Can someone give a code example where each is thrown?

    The IllegalAccessException is thrown when you try to use reflection to invoke a method or read or write a field that is forbidden by the Java visibility rules.

    An IllegalAccessError cannot be thrown by consistently compiled Java code. It occurs when for example, you load a class that attempts to invoke a method or read or write a field in another class that is forbidden by the Java visibility rules. This is something that the compiler would normally prevent, so this means there is something seriously wrong with the classes. At any rate, this is considered to be an “error”; i.e. not recoverable, and the classloader will refuse to load the offending class(es).

    Does the similarity in name imply relationship between the two, or is it just pure coincidence?

    There is a clear relationship between the two. The difference is the circumstances in which the two occur.

    Are there other XXXError and XXXException combo? How are the pairs related to each other?

    Pass. Check the javadocs.

    If you explicitly try to catch one in an Exception/Error pair, should you also catch the other?

    Probably not. The XXXError and XXXException generally occur in different circumstances. (This certainly applies to the reflective vs. classloader ones.)

    Besides, as a general rule you should not attempt to catch and recover from subtypes of Error. The whole point of separating Error from Exception is to distinguish the non-recoverable and (potentially) recoverable exceptions.

    In this case, there is nothing that a normal application can do in the way of recovering from the IllegalAccessError. If you attempt to repeat the classloader operation that caused the problem, it will just happen again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this example var task =Task.Factory.StartNew(()=>Console.WriteLine(test)); task.ContinueWith(antecendent => { ExceptionProcessor.HandleError(task.Exception.Flatten()); }, TaskContinuationOptions.OnlyOnFaulted); In this
Consider this pair of functions in C#: void func1() { DispatcherTimer tmr = new
Consider this situation: on a multi-monitor system, an application was maximized, then minimized, in
Consider this code: enum { ERR_START, ERR_CANNOTOPENFILE, ERR_CANNOTCONNECT, ERR_CANNOTCONNECTWITH, ERR_CANNOTGETHOSTNAME, ERR_CANNOTSEND, }; char* ERR_MESSAGE[]
Consider this contrived, trivial example: var foo = new byte[] {246, 127}; var bar
Consider this (rather pointless) javascript code: function make_closure() { var x = 123, y
Consider this simple model: A base Location table: +-------------------------------+ | Locations | +-------------------------------+ |(PK)
Consider this template function: template<typename ReturnT> ReturnT foo(const std::function<ReturnT ()>& fun) { return fun();
consider this simple function def foo(l=[]): if not l: print List is empty else
Consider this small program: #include <stdio.h> #include <stdlib.h> // Change 60000 to 70000 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.