0
0

More than 3 years have passed since last update.

Java 学習2(計算方法を学ぶ)

Last updated at Posted at 2020-06-20

記事の目的

業務でJavaを使うことになったので、
基本的なJavaの使い方をアウトプットし知識を整理するため

MyApp.java
public class MyApp{
  public static void main(String[] args){
   //演算
   int i;
   i = 10 / 3;
   System.out.println(i); 
   i = 10 % 3;
   System.out.println(i); 
   int x = 5;
   x++;
   System.out.println(x); 
   x--;
   System.out.println(x); 
  }
}
$ javac MyApp.java
$ java MyApp
3
1
6
5
MyApp.java
public class MyApp{
  public static void main(String[] args){
    //演算
    int x = 5;
    //x = x + 12;
    x += 12;
    System.out.println(x);

    String s;
    s = "hello" + "world!";
    System.out.println(s);
  }
}
$ javac MyApp.java
$ java MyApp
17
helloworld!
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