📄 appendix-b.html
字号:
public double doubleValue()
public boolean equals(Object obj)
public float floatValue()
public int hashcode()
public int intValue()
public long longValue()
public String toString()
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.Math</I></B></FONT></P>
<P>This class defines static methods that compute mathematical functions, as well as constants for E and PI.
</P>
<!-- CODE //-->
<PRE>
// public constants
public final static double E = 2.7182818284590452354;
public final static double PI = 3.1415926535897932846;
// public static methods
public static int abs(int a)
public static long abs(long a)
public static float abs(float a)
public static double abs(double a)
public static double acos(double a)
public static double asin(double a)
public static double atan(double a)
public static double atan2(double a, double b)
public static double ceil(double a)
public static double cos(double a)
public static double exp(double a)
public static double floor(double a)
public static double log(double a) throws ArithmeticException
public static int max(int a, int b)
public static long max(long a, long b)
public static float max(float a, float b)
public static double max(double a, double b)
public static int min(int a, int b)
public static long min(long a, long b)
public static float min(float a, float b)
public static double pow(double a, double b) throws ArithmeticException
public static double random()
public static double rint(double a)
public static int round(float a)
public static long round(double a)
public static double sin(double a)
public static double sqrt(double a) throws ArithmeticException
public static double tan(double a)
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.Object</I></B></FONT></P>
<P>Object is the root class of Java’s class hierarchy, and as a result, all other classes inherit Object’s methods. The getClass() method returns the Class object associated with an object.
</P>
<!-- CODE //-->
<PRE>
// constructor
public Object()
// public and protected instance methods
protected Object clone()
public boolean equals(Object obj)
protected void finalize()
public final Class getClass()
public int hashCode()
public final void notify() throws IllegalMonitorStateException
public final void notifyAll()throws IllegalMonitorStateException
public String toString()
public final void wait(long timeout) throws InterruptedException,
IllegalMonitorStateException
public final void wait(long timeout, int nanoseconds) throws
InterruptedException, IllegalMonitorStateException
public final void wait()throws InterruptedException,
IllegalMonitorStateException
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.Runnable (Interface)</I></B></FONT></P>
<P>The Runnable interface allows an object to pass itself as the target when instantiating a Thread instance. This interface comes in handy in creating animations.
</P>
<!-- CODE SNIP //-->
<PRE>
// public methods
public abstract void run()
</PRE>
<!-- END CODE SNIP //-->
<P><FONT SIZE="+1"><B><I>java.lang.String</I></B></FONT></P>
<P>The String class encapsulates an immutable string of characters (i.e., the characters can’t be changed). The StringBuffer class encapsulates character string data that can be altered.
</P>
<!-- CODE //-->
<PRE>
// constructors
public String()
public String(String str)
public String(StringBuffer strBuf)
public String(char ch[])
public String(char ch[], int startIndex, int numChars ) throws
StringIndexOutOfBoundsException
public String(byte ascii[], int hiByte, int startIndex, int numBytes)
throws StringIndexOutOfBoundsException
public String(byte ascii[], int hiByte)
// public static methods
public static String copyValueOf(char ch[] [, int index, int count])
// public static methods
public static String valueOf(boolean b)
public static String valueOf(char ch)
public static String valueOf(int i)
public static String valueOf(long l)
public static String valueOf(float f)
public static String valueOf(double d)
public static String valueOf(Object obj)
public static String valueOf(char ch[], int index, int count])
// public instance methods
public char charAt(int index) throws StringIndexOutOfBoundsException
public int compareTo(Sting str2)
public String concat(String str)
public boolean endsWith(String suffix)
public boolean equals(Object obj2)
public boolean equalsIgnoreCase(Object obj2)
public void getBytes(int srcStartIndex, int srcEndIndex, char dest[], int
destIndex)
public void getChars(int srcStartIndex, int srcEndIndex, char dest[], int
destIndex)
public int hashCode()
public int indexOf(int ch, int index)
public int indexOf(String str, int index)
public String intern()
public int lastIndexOf(int ch, int index)
public int lastIndexOf(String substr, int index)
public int length()
public boolean regionMatches(boolean ignoreCase, int thisIndex, ⇐
Sting str2, int str2Index, int numChars)
public String replace(char oldChar, char newChar)
public boolean startsWith(String prefix, int startingChar)
public String subString(int startIndex, int endIndex) throws
StringIndexOutOfBoundsException
char[] toCharArray()
public String toLowerCase()
public String toString()
public String toUpperCase()
public String trim()
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.StringBuffer</I></B></FONT></P>
<P>This class encapsulates a growable string of characters.
</P>
<!-- CODE //-->
<PRE>
// constructors
public StringBuffer()
public StringBuffer(int length)
public StringBuffer(String str)
// public instance methods
public synchronized StringBuffer append(boolean b)
public synchronized StringBuffer append(char ch)
public synchronized StringBuffer append(int i)
public synchronized StringBuffer append(long l)
public synchronized StringBuffer append(float f)
public synchronized StringBuffer append(double d)
public synchronized StringBuffer append(String str)
public synchronized StringBuffer append(Object obj)
public synchronized StringBuffer append(char ch[][, int index, int count])
public int capacity()
public synchronized char charAt(int index) throws
StringIndexOutOfBoundsException
void copyWhenShared()
public synchronized void ensureCapacity(int minCapacity)
void getChars(int srcStartIndex, int srcEndIndex, char dest[], int ⇐
destIndex) throws StringIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, boolean b) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, char ch[])throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insertChar(int index, int ch) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, int i) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, long l) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, float f) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, double d) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, String str) throws
ArrayIndexOutOfBoundsException
public synchronized StringBuffer insert(int index, Object obj) throws
ArrayIndexOutOfBoundsException
public int length()
public synchronized void charAt(int index, char newCh) throws
ArrayIndexOutOfBoundsException
public synchronized void setLength(int newLength) throws
StringIndexOutOfBoundsException
public synchronized String toString()
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.System</I></B></FONT></P>
<P>This final class defines static variables and methods to access system functions in a platform-independent way. Methods such as arraycopy() (copy an array) and currentTimeMillis() (return the current time in milliseconds) are particularly useful.
</P>
<!-- CODE //-->
<PRE>
// public static variables
public static PrintStream err
public static InputStream in
public static PrintStream out
// public static methods
public static void arraycopy(Object src, int srcIndex, Object dest, int
destIndex, int length) throws ArrayIndexOutOfBoundsException,
ArrayStoreException
public static long currentTimeMillis()
public static void exit(int status)
public void gc()
public static String getProperties()
public static String getProperty(String key)
public static String getProperty(String key, String def)
public static SecurityManager getSecurityManager()
public static void load(String pathName) throws UnsatisfiedLinkError
public static void loadLibrary(String libraryName) throws
UnsatisfiedLinkError
public static void runFinalization()
public static void setProperties(Properties props)
public static void setSecurityManager(SecurityManager sec) throws
SecurityException
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.Thread</I></B></FONT></P>
<P>This class encapsulates a separate thread of execution. Threads are covered in Chapter 8, Implementing a High Score Server on a Network, and Chapter 10, Advanced Techniques.
</P>
<!-- CODE //-->
<PRE>
// constructors
public Thread()
public Thread(Runnable target)
public Thread(Runnable target, String name)
public Thread(String name)
public Thread(ThreadGroup group, Runnable target)
public Thread(ThreadGroup group, String name)
public Thread(ThreadGroup group, String name, Runnable target)
// public constants
public static int MIN_PRIORITY
public static int NORM_PRIORITY
public static int MAX_PRIORITY
// public static methods
public static int activeCount()
public static Thread currentThread()
public static void dumpStack()
public static int enumerate(Thread threadArray[])
public static boolean interrupted()
public static boolean isInterrupted()
public static void sleep(long milliseconds) throws InterruptedException
public static void sleep(long milliseconds, int nanoseconds) throws
InterruptedException
public static void yield()
// public instance methods
public void checkAccess() throws SecurityException
public int countStackFrames() throws IllegalThreadStateException
public void destroy()
public final String getName()
public final int getPriority()
public final ThreadGroup getThreadGroup()
public void interrupt()
public final boolean isAlive()
public final boolean isDaemon()
public synchronized void join() throws InterruptedException
public synchronized void join(long milliseconds) throws ⇐
InterruptedException
public synchronized void join(long milliseconds, int nanoseconds]) throws
InterruptedException
public final void resume()
public void run()
public final void setDaemon(boolean state) throws ⇐
IllegalThreadStateException
public final void setName(String newName)
public final void setPriority(int newPriority) throws ⇐
IllegalArgumentException
public synchronized void start() throws IllegalThreadStateException
public final void stop()
public final void suspend()
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.ThreadGroup</I></B></FONT></P>
<P>A ThreadGroup object consists of a set of threads and/or other ThreadGroup objects. Every thread is a member of some thread group; the thread group provides limits on the threads it contains.
</P>
<!-- CODE //-->
<PRE>
// constructors
ThreadGroup(String grpName)
ThreadGroup(ThreadGroup parent, String grpName) throws
NullPointerException
// public instance methods
public synchronized int activeCount()
public synchronized int activeGroupCount()
public final void checkAccess() throws SecurityException
public final synchronized void destroy() throws ⇐
IllegalThreadStateException
public int enumerate(Thread list[], boolean recurse)
public int enumerate(ThreadGroup list[], boolean recurse)
public final int getMaxPriority()
public final String getName()
public final ThreadGroup getParent()
public final boolean isDaemon()
public synchronized void list()
public final boolean parentOf(ThreadGroup grp)
public final synchronized void resume()
public final void setDaemon(boolean daemon)
public final void setMaxPriority(int priority)
public final synchronized void stop()
public final void suspend()
public String toString()
public void uncaughtException(Thread thread, Throwable exception)
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B><I>java.lang.Throwable</I></B></FONT></P>
<P>All errors and exceptions are subclasses of the Throwable class. The methods defined in Throwable provide diagnostics when an error or exception occurs.
</P>
<!-- CODE SNIP //-->
<PRE>
// constructors
public Throwable()
public Throwable(String message)
// public instance methods
public Throwable fillInStackTrace()
public String getMessage()
public void printStackTrace(PrintStream prt)
public String toString()
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="ewtoc.html">Table of Contents</A></TD>
</TR>
</TABLE>
</CENTER>
</BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -