Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Section2-ArithmeticDemo

/**
 * Demonstrates the five arithmetic operators.
 * 
 * @author Brandon Bopp
 */
public class ArithmeticDemo {

     public static void main(String []args) {
         int x = 13;
         int y = 5;
         
         // perform some arithmetic
         int z1 = x + y;
         int z2 = x - y;
         int z3 = x * y;
         int z4 = x / y;
         int z5 = x % y;
         
         // This is a multiline comment that
         // is really pretty useless but I have
         // to say SOMEthing.
         System.out.println(z1);
         System.out.println(z2);
         System.out.println(z3);
         System.out.println(z4);
         System.out.println(z5);
         
         /* This is a multiline comment.
            see... it spans many lines.
            blah blah blah. */
            
        System.out.println(x * 7 + y);
        System.out.println(2.34 / 8.196);
        System.out.println("abc" + "xyz");
        
        System.out.println("The remainder is " + z5);
     }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.