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 【入門】

Posted at

##javaを初めて学びました

####HelloWorld 文字出力

public class Main {
	public static void main(String[] args) {
		System.out.println("hello, world!");
	}
}

出力

Hello World!

System.out.printlnが出力
文字列は””で囲う
おわりには;をつける

####計算方法

public class Main {
	public static void main(String[] args) {
		System.out.println("hello, world!");

		System.out.println("31+31の計算をします");

		System.out.println(31+31);
	}
}

出力

hello, world!
31+31の計算をします
62

数式の場合は”で囲わない

####変数の定義と掛け算

public class Main {
	public static void main(String[] args) {
	    int x;
	    x = 6;
		System.out.println(x * x * 3.14);
	}
}

出力

113.04

intは数字を定義するときに使う

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?