The
java.lang Subpackages
Java defines several
subpackages of java.lang:
java.lang.annotation
java.lang.instrument
java.lang.management
java.lang.ref
java.lang.reflect
Each is briefly described
here.
java.lang.annotation
Java’s annotation facility is
supported by java.lang.annotation.
It defines the Annotation interface,
the ElementType and RetentionPolicy enumerations, and
several predefined annotations. Annotations are described in Chapter 12.
java.lang.instrument
java.lang.instrument defines features that can be used to add
instrumentation to various aspects
of program execution. It defines the Instrumentation
and ClassFileTransformer interfaces,
and the ClassDefinition class.
java.lang.invoke
java.lang.invoke supports dynamic languages. It includes classes
such as CallSite,
MethodHandle, and MethodType.
java.lang.management
The java.lang.management package provides management support for the
JVM and the execution environment. Using the features in java.lang.management, you can observe and manage various aspects of
program execution.
java.lang.ref
You learned earlier that the
garbage collection facilities in Java automatically determine when no
references exist to an object. The object is then assumed to be no longer
needed and its memory is reclaimed. The classes in the java.lang.ref package provide more flexible control over the
garbage collection process.
java.lang.reflect
Reflection is the ability of a program to analyze code at run time. The java.lang.reflect package provides the ability to obtain
information about the fields, constructors, methods, and modifiers of a class.
Among other reasons, you need this information to build software tools that
enable you to work with Java Beans components. The tools use reflection to
determine dynamically the characteristics of a component. Reflection was
introduced in Chapter 12 and is also examined in Chapter 30.
java.lang.reflect defines several classes,
including Method, Field, and Constructor. It also
defines several interfaces, including AnnotatedElement,
Member, and Type. In addition, the java.lang.reflect
package includes the Array class
that enables you to create and access arrays dynamically.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.