|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
java.lang.Byte
public final class Byte
The Byte
class wraps a value of primitive type byte
in an object.
Number
,
Serialized FormField Summary | |
---|---|
static byte |
MAX_VALUE
A constant holding the maximum value a byte can
have, 27-1. |
static byte |
MIN_VALUE
A constant holding the minimum value a byte can
have, -27. |
Constructor Summary | |
---|---|
Byte(byte b)
Constructs a newly allocated Byte object that
represents the specified byte value. |
Method Summary | |
---|---|
byte |
byteValue()
Returns the value of this Byte as a
byte . |
double |
doubleValue()
Returns the value of this Byte as a
double . |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
float |
floatValue()
Returns the value of this Byte as a
float . |
int |
hashCode()
Returns a hash code value for the object. |
int |
intValue()
Returns the value of this Byte as an
int . |
long |
longValue()
Returns the value of this Byte as a
long . |
static byte |
parseByte(String s)
Assuming the specified String represents a byte, returns that byte's value. |
static byte |
parseByte(String s,
int radix)
Assuming the specified String represents a byte, returns that byte's value. |
short |
shortValue()
Returns the value of this Byte as a
short . |
String |
toString()
Returns a String object representing this Byte's value. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final byte MIN_VALUE
byte
can
have, -27.
public static final byte MAX_VALUE
byte
can
have, 27-1.
Constructor Detail |
---|
public Byte(byte b)
Byte
object that
represents the specified byte
value.
b
- the value to be represented by the
Byte
.Method Detail |
---|
public byte byteValue()
Byte
as a
byte
.
byteValue
in class Number
byte
.public short shortValue()
Byte
as a
short
.
shortValue
in class Number
short
.public int intValue()
Byte
as an
int
.
intValue
in class Number
int
.public long longValue()
Byte
as a
long
.
longValue
in class Number
long
.public double doubleValue()
Byte
as a
double
.
doubleValue
in class Number
double
.public float floatValue()
Byte
as a
float
.
floatValue
in class Number
float
.public String toString()
toString
in class Object
public static byte parseByte(String s) throws NumberFormatException
s
- the String containing the byte
NumberFormatException
- If the string does not
contain a parsable byte.public static byte parseByte(String s, int radix) throws NumberFormatException
s
- the String containing the byteradix
- the radix to be used
NumberFormatException
- If the String does not
contain a parsable byte.public int hashCode()
Object
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public boolean equals(Object obj)
Object
The equals
method implements an equivalence relation:
x
,
x.equals(x)
should return true
.
x
and
y
, x.equals(y)
should return
true
if and only if y.equals(x)
returns
true
.
x
,
y
, and z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return
true
.
x
and y
, multiple invocations of x.equals(y)
consistently return true
or consistently return
false
, provided no information used in
equals
comparisons on the object is modified.
x
,
x.equals(null)
should return false
.
The equals method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any reference values x
and y
,
this method returns true
if and only if x
and
y
refer to the same object (x==y
has the
value true
).
equals
in class Object
obj
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.Boolean.hashCode()
,
Hashtable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |