java.lang
System
: The System
class contains several
useful class fields and methods. It cannot be instantiated.System.in
), standard output (System.out
), and
error output streams (System.err
); access to externally defined
"properties"; terminate currently running Java Virtual
Machine(System.exit(int)
); get the time
(currentTimeMillis()
): returns the current time in milliseconds
starts from 1970 1/1. Object
class.
String
, StringBuffer
class to handle
String
Math
: contains all the math-related constants and methods.
Class
class to get information for a particular class.
Thread
class.
Boolean, Byte, Character, Double, Float, Integer, Long, Short
type-wrapper classes. The classes correspond to the primitive
classes. java.lang
is automatically imported. java.long
we have classes
Boolean, Byte, Character, Double, Float, Integer, Long, Short
. They
correspond to the primitive classes boolean, byte, char, double, float,
int, long, short
respectively. Vector
class can hold only
objects, if you want to put numbers in a vector, you wrap each value in a
type-wrapper object and provide that object to the vector.
MIN_VALUE
and
MAX_VALUE
. The classes also define useful methods for converting
values to other types, for converting to strings and so on. Double
as an example.
Number
class which has the following methods
Member | Description |
byte byteValue(), short shortValue(), int intValue(), long
longValue(), float floatValue(), double doubleValue() |
Convert the value of this number object to the primitive date types of
byte, short, int, long, float and double
|
Constructors or members | Description |
static double MAX_VALUE, |
max/min value |
static double NaN |
Not a number |
static double NEGATIVE_INFINITY, . | |
public Double(double value), |
meaning is clear |
String toString(), |
Returns a String representation. |
static double parseDouble(String s) throws
NumberFormatException, |
Returns a new double(or Double) initialized to the value represented by the specified String. |
boolean equals(Object) |
determine if the object is equal to the Double |
int compareTo(Double anotherDouble) |
Compares two Doubles numerically. The value is bigger then 0 if the
Double is bigger than anotherDouble etc.
|
valueOf
and
parseDouble
?
long
.
double d = 3.15
to a
Double
?
float
?
int
and how?
String
? valueOf
returns the class Double
.
parseDouble
returns the primitive type
double
.
Double d2 = new Double(3.15)
to change it to a
Double
.
(float)3.15
(casting) or d2.floatValue()
.
(int)3.15
(casting) or d2.intValue()
.
d2.toString()
or Double.toString(d)