|
基本データ型
|
ラッパークラス
|
|
byte
|
Byte
|
|
short
|
Short
|
|
int
|
Integer
|
|
long
|
Long
|
|
float
|
Float
|
|
double
|
Double
|
|
char
|
Character
|
|
boolean
|
Boolean
|
|
byteValue()
shortValue() intValue()
longValue()
floatValue() doubleValue()
|
|
Integer a = new
Integer(30); ←コンストラクタは対応する基本データ型の値や変数を受け取る
Double b =
a.doubleValue();
|
|
Integer a = new
Integer(10);
Integer b = new
Integer(5);
Boolean c =
a.equals(b); ←等しければtrue
|
|
クラス
|
メソッド
|
働き
|
|
Byte
|
parseByte()
|
文字列をbyte型に変換
|
|
Short
|
parseShort()
|
文字列をshort型に変換
|
|
Long
|
parseLong()
|
文字列をlong型に変換
|
|
Integer
|
parseInteger()
|
文字列をint型に変換
|
|
Int a =
Integer.parseInt(“5”); ←aの値は5になります。
|