short
| 日本語 | 短 |
| 英語 | short |
| ふりがな | しょーと |
| フリガナ | ショート |
整数値を格納するための型。
プリミティブ型のひとつ。
ラッパークラスはShortクラス。
16ビット(2バイト)の情報量を持ち、-32768~32767までの整数値を格納することができる。
非常に中途半端なサイズのため、滅多に使用されない。
2バイトというとUnicodeの文字と同じサイズだが、文字には専用の型としてchar型があるため、やはり必要ない。
プリミティブ型のひとつ。
ラッパークラスはShortクラス。
16ビット(2バイト)の情報量を持ち、-32768~32767までの整数値を格納することができる。
非常に中途半端なサイズのため、滅多に使用されない。
2バイトというとUnicodeの文字と同じサイズだが、文字には専用の型としてchar型があるため、やはり必要ない。
参考サイト
// Sample.java
public class Sample
{
public static void main( String[] args )
{
// short型の変数を作ります。
short sh = 100;
System.out.println( sh );
// 100
// 最大値と最小値はShortクラスにあります。
sh = Short.MAX_VALUE;
System.out.println( sh );
// 32767
sh = Short.MIN_VALUE;
System.out.println( sh );
// -32768
}
}
public class Sample
{
public static void main( String[] args )
{
// short型の変数を作ります。
short sh = 100;
System.out.println( sh );
// 100
// 最大値と最小値はShortクラスにあります。
sh = Short.MAX_VALUE;
System.out.println( sh );
// 32767
sh = Short.MIN_VALUE;
System.out.println( sh );
// -32768
}
}
// Sample.java
public class Sample
{
public static void main( String[] args )
{
// short型の変数を作ります。
short sh = 100;
System.out.println( sh );
// 100
// 最大値と最小値はShortクラスにあります。
sh = Short.MAX_VALUE;
System.out.println( sh );
// 32767
sh = Short.MIN_VALUE;
System.out.println( sh );
// -32768
}
}




