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 1 year has passed since last update.

Javaを基本からまとめてみた【データ型】

Last updated at Posted at 2023-03-04

データ型

データ型:データの種類

① 基本データ型
⇨ 整数 少数 文字 真偽値

<データ型の一覧>

データ型 種類 データの幅 データの表現範囲
byte 整数 8ビット -128 ~ 127
short 整数 16ビット − 2の15乗~2の15乗 − 1(-32,768 ~ 32,767)
int 整数 32ビット − 2の31乗~2の31乗 − 1(-2,147,483,648 ~ 2,147,483,647)
long 整数 64ビット − 2の63乗~2の63乗 − 1(-9,223,372,036,854,775,808L ~9,223,372,036,854,775,807L)
float 浮動小数点数 32ビット IEEE 754 規格の単精度浮動小数点数
double 浮動小数点数 64ビット IEEE 754 規格の単精度浮動小数点数
char 文字 16ビット Unicode規格の1文字(\u0000~\uFFFF)
boolean 論理値 1ビット trueまたはfalse
  • 数値はデフォルトで『int』と『dobule』
    ⇨ float型の少数にはf(F)をlong型の整数にはl(L)を付ける

  • 文字のデータは'で囲む。

② 参照型(文字列:String)
⇨ 文字列 配列
String name = "菅原";

  • データ自体はメモリ上の別の場所に置かれてそのアドレスの値(参照値)が変数に入る

参考サイト

基本データ型と参照型:基本データ型全8種類と文字列(String)型の初心者向け解説【Java入門講座】2-3 データ型

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?