Arithmetic Operators
- Arithmetic Operators are,
- + Additive (also for String concatenation)
- - Subtraction
- * Multiplication
- / Division
- % Remainder
- By seeing above symbols hope everyone knows what ll happen with corresponding operators. Appreciate for your remembrance.
+    Addition   
❏   adds one value to another value and produces the result
❏   Joins the two String values and gives us result
-      Subtraction
❏   Subtracts one value from another value and produces the result
    *  Multiplication
❏   Multiplies one value with other value and produces the result
     / Division
❏   It divides the value  and produces the result
    % Remainder
❏   The remainder of the Division operation
---------------------------------------------------------------------------------------
Program : All arithmetic Operations
Program : All arithmetic Operations
Program name :       OpeDemo1.java
Output             :        
                             x + y = 30
     x - y  = -10
     x * y = 200
     y / x  = 2
     x % 3= 1
class OpeDemo1
{
        public static void main(String args[])
        {
            int x = 10;
            int y = 20;
            int add= x + y;
            System.out.println("x + y = " + add);
            int sub = x - y;
            System.out.println("x - y = " + sub);
            int mul = x * y;
            System.out.println("x * y = " + mul);
            int division= y / x;
            System.out.println("y / x = " + division);
            int mod = x % 3;
            System.out.println("x % 3 = " + mod);
        }
}
Compile     :            javac OpeDemo1.java
Run           :            java OpeDemo1
Output       :        
                             x + y = 30
     x - y  = -10
     x * y = 200
     y / x  = 2
     x % 3= 1
---------------------------------------------------------------------------------------
Program        :       + Operator using with String objects
Program name :       OpeDemo2.java
Output            : 
                             Hello Please dont sleep
class OpeDemo2
{
        public static void main(String args[])
        {
              String firstValue = "Hello";
              String secondValue = "Please dont sleep";
              String result= firstValue + secondValue ;
        }
}
Compile     :            javac OpeDemo2.java
Run           :            java OpeDemo2
Output       : 
                             Hello Please dont sleep
---------------------------------------------------------------------------------------
Thanks for your time.
Thanks for your time.
Nireekshan
