LoginSignup
1
0

More than 3 years have passed since last update.

[Java]出力、変数

Posted at

標準出力

System.out.println()

System.out.println("Hello World");

変数

変数定義
データ型 変数名;

String hello;
hello = "Hello World";
System.out.println(hello);

こちらでも意味は一緒

String hello = "Hello World";
System.out.println(hello);

型変換

強制型変換(キャスト)
出力の時に型を強制的に変換する

例:int型同士の計算結果を小数点で出したい(本来は小数点はでない)

int num1 = 10;
int num2 = 4;
System.out.println((double)num1 / num2);
1
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
1
0