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

ArithmeticDemo

/**
 * Demonstrates the five arithmetic operators.
 * 
 * @author Lauren Ferrara
 */
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 multiline
        // comment
        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
           it spans many lines */
        
        System.out.println(x * 7 + y);
     }
}

Advertisements
Loading...

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