

class Jan13 {

    public static void main(String[] args) {

        // Primitive type variable declarations AND initialization

        // Java REQUIRES that all variables be initialized when they are declared

        int age = 18;
        char initial = 'E';             // characters are surrounded by single quotes
        double area = 5.12;
        boolean isOpen = true;

        System.out.println("age: " + age);
        System.out.println("initial: " + initial);
        System.out.println("area: " + area);
        System.out.println("isOpen: " + isOpen);

        // we can change the value of a variable at any time with an assignment statement

        // Remember the order - variable EQUALS value

        age = 19;
        initial = 'Z';
        area = 12.2;
        isOpen = false;

        // We can change the value of a variable using a more complex expressions like arithmetic

        // Add 2 to the value of age - age EQUALS the current value of age plus 2

        // The three expressions below are equivalent */

        age = (age + 2);
        age = age + 2;
        age += 2;

        // When we want to add one to the current value of a variable we can write it in many ways.

        // The four expressions below are equivalent

        age = (age + 1);
        age = age + 1;
        age += 1;
        age++;                  // we can also subtract 1 from a variable using --

        /* The symbols for standard arithmetic are as follows:

            +   addition
            -   subtraction
            *   multiplication
            /   division

        */

    }
}