Arithmetic Calculations : Arithmetic Operators « Operators « Java Tutorial






An assignment statement has three elements:

  1. the variable to store the result,
  2. the assignment operator: =,
  3. an arithmetic expression

The statement is terminated by a semicolon.

public class MainClass{
  public static void main(String[] argv){
     int a = 1;
     int b = 2;
     int c = 0;
     
     c = a + b;
     
     System.out.println(c);
  }

}
3








3.4.Arithmetic Operators
3.4.1.Arithmetic Calculations
3.4.2.Arithmetic Operators
3.4.3.The Basic Arithmetic Operators
3.4.4.Demonstrates the mathematical operators
3.4.5.Modulus operator %: obtain the remainder after a division
3.4.6.Applying the modulus operator, %, to floating-point values