Nov 25, 2011


The java.lang package contains the various classes that are essential to the definition of the Java language or that, by their nature, need to access the internals of Java in a way that most classes cannot do. For example, the string class java.lang.String is part of the language definition, and java.lang.Thread is used to control concurrent threads of execution in Java. The java.lang package contains the primordial class Object, of which every Java class is a subclass. It also contains wrapper classes for the various primitive types, which allow you to treat an int, for example, as a bona fide Java object (instance of a subclass of Object), by instantiating a java.lang.Integer. You need to do this in order to store integers in a vector array (java.util.Vector), for example. Objects belonging to these wrapper classes are freely convertible into the corresponding primitive type.


Post a Comment