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 3 years have passed since last update.

JavaとKotlinの基本

0
Last updated at Posted at 2022-01-01

出力

sample.java
System.out.println("Hello World");
>_コンソール
Hello World
sample.kt
println("Hello World");
>_コンソ
Hello World

変数の定義

sample.java
//変数の初期化
int number = 3;
String name = "Hanaki";
//変数の更新
name = "Kawatani";
//自己代入の省略形「1を足す」「1を引く」
number++;
number--;
sample.kt
var number: Int = 3
var name = "Hanaki"
//Kotlinには型推論機能があり、型の指定を省略できる

データ型

ビット幅 種類
Double 64ビット 浮動小数点数
Float 32ビット 浮動小数点数
Long 64ビット 整数
Int 32ビット 整数
Short 16ビット 整数
Byte 8ビット 整数
String - 文字列
Char - 文字
ULong 64(符号なし) 整数
UInt 32(符号なし) 整数
UShort 16(符号なし) 整数
UByte 8(符号なし) 整数
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?