0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Java基礎学習内容1(リテラル・変数・定数)

Posted at

この記事は?

Javaを基礎から学習し直した際に、今まで理解不足だった点が多いと感じたため、後から見返せるよう学習内容をまとめたものです。

リテラル

リテラルとは、ソースコード中に値を直接表記したもののことを指す。

種類 備考
整数リテラル 10進数だけでなく、2進数(0b)・8進数(0)・16進数(0x)でも書ける。 10, 0b101, 0752, 0xfe
浮動小数点数リテラル 10進数・指数を書ける。 10.0, 2e3
文字リテラル 1文字を表現する。\uから始めるとUnicode値を表現できる。 'A', '\u0041'
文字列リテラル 複数文字列を表現する。 "abcde"
理論値リテラル trueかfalseを表現する。 true, false
nullリテラル 参照が無いことを表現する。 null

予約語

識別子(変数やクラスなどにつける名前)に使うことが出来ない、Java言語ですでに使用されている名前。
※「java」は予約語ではない。

基本データ型

サイズ
byte 8ビット
short 16ビット
int 32ビット
long 64ビット
float 32ビット
double 64ビット
char 16ビット
boolean 1ビット
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?