Type Erasure
In order to preserve
backwards compatibility, generic types are removed by the
compiler and replaced with object casts in a process called type erasure.
Type erasure prevents the need for legacy code to be recompiled, but it also
introduces several limitations. For example, generic
exceptions are not allowed
because a catch block cannot tell the difference between
a GenericException
and
a GenericException. Similarly, a class cannot implement
both Comparable and Comparable, because
without generic types they both represent the same interface.
Concurrency
Java supports concurrent programming through the use of threads.
A thread
is a single path of execution in an application. The JVM typically launches
as a single process, spawning multiple threads that share its resources. Threads
that modify shared resources must be coordinated
in order to prevent
unpredictable behavior.