Package java.lang


Package java.lang

Java 1.0

The java.lang package contains the classes that are most central to the Java language. Object is the ultimate superclass of all Java classes and is therefore at the top of all class hierarchies. Class is a class that describes a Java class. There is one Class object for each class that is loaded into Java.

Boolean , Character , Byte , Short , Integer , Long , Float , and Double are immutable class wrappers around each of the primitive Java data types. These classes are useful when you need to manipulate primitive types as objects. They also contain useful conversion and utility methods . Void is a related class that defines a representation for the void method return type, but that defines no methods. String and StringBuffer are objects that represent strings. String is an immutable type, while StringBuffer can have its string changed in place. In Java 5.0, StringBuilder is like StringBuffer but without synchronized methods, which makes it the preferred choice in most applications. String , StringBuffer and StringBuilder implement the Java 1.4 interface CharSequence which allows instances of these classes to be manipulated through a simple shared API.

String and the various primitive type wrapper classes all implement the Comparable interface which defines an ordering for instances of those classes and enables sorting and searching algorithms (such as those of java.util.Arrays and java.util.Collections , for example). Cloneable is an important marker interface that specifies that the Object.clone( ) method is allowed to make copies of an object.

The Math class (and, in Java 1.3, the StrictMath class) defines static methods for various floating-point mathematical functions.

The THRead class provides support for multiple threads of control running within the same Java interpreter. The Runnable interface is implemented by objects that have a run( ) method that can serve as the body of a thread.

System provides low-level system methods. Runtime provides similar low-level methods, including an exec ( ) method that, along with the Process class, defines a platform-dependent API for running external processes. Java 5.0 allows Process objects to be created more easily with the ProcessBuilder class.

Throwable is the root class of the exception and error hierarchy. THRowable objects are used with the Java tHRow and catch statements. java.lang defines quite a few subclasses of Throwable . Exception and Error are the superclasses of all exceptions and errors. RuntimeException defines a special class or "unchecked exceptions" that do not need to be declared in a method's throws clause. The Throwable class was overhauled in Java 1.4, adding the ability to "chain" exceptions, and the ability to obtain the stack trace of an exception as an array of StackTraceElement objects.

Java 5.0 adds three important interfaces to this package. Iterable marks types that have an iterator( ) method and enables iteration with the for/in looping statement introduced in Java 5.0. The Appendable interface is implemented by classes (such as StringBuilder and character output streams) that can have characters appended to them. Implementing this interface enables formatted text output with a java.util.Formatter . The Readable interface is implemented by classes (such as character input streams) that can sequentially copy characters into a buffer. It enables interaction with a java.util.Scanner .

Also new in Java 5.0 is Enum , which serves as the superclass of all enumerated types declared with the new enum keyword. Deprecated , Override , and SuppressWarnings are annotation types that provide metadata for the compiler.

Interfaces

 public interface  Appendable  ; public interface  CharSequence  ; public interface  Cloneable  ; public interface  Comparable  <T>; public interface  Iterable  <T>; public interface  Readable  ; public interface  Runnable  ; public interface  Thread.UncaughtExceptionHandler  ; 

Enumerated Types

 public enum  Thread.State  ; 

Annotation Types

 public @interface  Deprecated  ; public @interface  Override  ; public @interface  SuppressWarnings  ; 

Classes

 public class  Object  ;    abstract class  AbstractStringBuilder  implements Appendable, CharSequence;       public final class  StringBuffer  extends AbstractStringBuilder implements        CharSequence, Serializable;       public final class  StringBuilder  extends AbstractStringBuilder implements        CharSequence, Serializable;    public final class  Boolean  implements Serializable, Comparable<Boolean>;    public final class  Character  implements Serializable, Comparable<Character>;    public static class  Character.Subset  ;       public static final class  Character.UnicodeBlock  extends Character.Subset;    public final class  Class  <T> implements Serializable, java.lang.reflect.       GenericDeclaration, java.lang.reflect.Type, java.lang.reflect.AnnotatedElement;    public abstract class  ClassLoader  ;    public final class  Compiler  ;    public abstract class  Enum  <E extends Enum<E>> implements Comparable<E>,     Serializable;    public final class  Math  ;    public abstract class  Number  implements Serializable;       public final class  Byte  extends Number implements Comparable<Byte>;       public final class  Double  extends Number implements Comparable<Double>;       public final class  Float  extends Number implements Comparable<Float>;       public final class  Integer  extends Number implements Comparable<Integer>;       public final class  Long  extends Number implements Comparable<Long>;       public final class  Short  extends Number implements Comparable<Short>;    public class  Package  implements java.lang.reflect.AnnotatedElement;    public abstract class  Process  ;    public final class  ProcessBuilder  ;    public class  Runtime  ;    public class  SecurityManager  ;    public final class  StackTraceElement  implements Serializable;    public final class  StrictMath  ;    public final class  String  implements Serializable, Comparable<String>, CharSequence;    public final class  System  ;    public class  Thread  implements Runnable;    public class  ThreadGroup  implements Thread.UncaughtExceptionHandler;    public class  ThreadLocal  <T>;       public class  InheritableThreadLocal  <T> extends ThreadLocal<T>;    public class  Throwable  implements Serializable;    public final class  Void  ; public final class  RuntimePermission  extends java.security.BasicPermission; 

Exceptions

 public class  Exception  extends Throwable;    public class  ClassNotFoundException  extends Exception;    public class  CloneNotSupportedException  extends Exception;    public class  IllegalAccessException  extends Exception;    public class  InstantiationException  extends Exception;    public class  InterruptedException  extends Exception;    public class  NoSuchFieldException  extends Exception;    public class  NoSuchMethodException  extends Exception;    public class  RuntimeException  extends Exception;       public class  ArithmeticException  extends RuntimeException;       public class  ArrayStoreException  extends RuntimeException;       public class  ClassCastException  extends RuntimeException;       public class  EnumConstantNotPresentException  extends RuntimeException;       public class  IllegalArgumentException  extends RuntimeException;          public class  IllegalThreadStateException  extends IllegalArgumentException;          public class  NumberFormatException  extends IllegalArgumentException;       public class  IllegalMonitorStateException  extends RuntimeException;       public class  IllegalStateException  extends RuntimeException;       public class  IndexOutOfBoundsException  extends RuntimeException;          public class  ArrayIndexOutOfBoundsException  extends IndexOutOfBoundsException;          public class  StringIndexOutOfBoundsException  extends IndexOutOfBoundsException;       public class  NegativeArraySizeException  extends RuntimeException;       public class  NullPointerException  extends RuntimeException;       public class  SecurityException  extends RuntimeException;       public class  TypeNotPresentException  extends RuntimeException;       public class  UnsupportedOperationException  extends RuntimeException; 

Errors

 public class  Error  extends Throwable;    public class  AssertionError  extends Error;    public class  LinkageError  extends Error;       public class  ClassCircularityError  extends LinkageError;       public class  ClassFormatError  extends LinkageError;          public class  UnsupportedClassVersionError  extends ClassFormatError;       public class  ExceptionInInitializerError  extends LinkageError;       public class  IncompatibleClassChangeError  extends LinkageError;          public class  AbstractMethodError  extends IncompatibleClassChangeError;          public class  IllegalAccessError  extends IncompatibleClassChangeError;          public class  InstantiationError  extends IncompatibleClassChangeError;          public class  NoSuchFieldError  extends IncompatibleClassChangeError;          public class  NoSuchMethodError  extends IncompatibleClassChangeError;       public class  NoClassDefFoundError  extends LinkageError;       public class  UnsatisfiedLinkError  extends LinkageError;       public class  VerifyError  extends LinkageError;    public class  ThreadDeath  extends Error;    public abstract class  VirtualMachineError  extends Error;       public class  InternalError  extends VirtualMachineError;       public class  OutOfMemoryError  extends VirtualMachineError;       public class  StackOverflowError  extends VirtualMachineError;       public class  UnknownError  extends VirtualMachineError; 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net