I am trying to fathom the following lines from Effective Java
One thing that makes Java such a pleasure to use is that it is a safe language. This
means that in the absence of native methods it is immune to buffer overruns, array
overruns, wild pointers, and other memory corruption errors that plague unsafe
languages such as C and C++. In a safe language, it is possible to write classes and
to know with certainty that their invariants will remain true, no matter what
happens in any other part of the system.
What are buffer overruns,array overruns(I do not want very much details here,just simple overview only) and what feature of Java makes programs immune to overuns ?
Java throws an
ArrayIndexOutOfBoundsExceptionwhen you try to look up a value outside the bounds of an array, instead of causing a segfault, unpredictable (and possibly problematic from a security perspective) behavior, or just crashing your operating system.(Yes, that’s what C, C++, etc. do.)