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?

JAVAをたまにしか書かないのでコードのメモを置く

Posted at

はじめに

1年ほどJAVAを書いておらず、基礎文法を忘れかけていたのでこの記事にメモ書きする。

JAVAメモ

テンプレ(main.javaだとする)
public class main{
    public static void main(String[] args){
    }
}
何かを入力・出力したい時
import java.util.Scanner;

public class main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(); //単変数の場合
        int[] A = new int [n];  //配列の場合
        for(int i=0;i<n;i++){
          A[i] = scan.nextInt();
        }
        System.out.print(n);
        for(int j=0;j<n;j++){
          System.out.println(A[j]);
        }
    }
}
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?