/*
 * Working with Integers
 * Note that this does not compile
 * Created: Aug 14, 2023
 * @author gtowell
 */

public class FunWithInts {
    public static void main(String[] args) {
        int x; // declare; uninitialized
        int y = 4; // declare and initialize
        x = y; // assign; now x is 4
        y = 3; // what is x? still 4
        System.out.println(x); // prints 4
        x = y + 11; // assign using addition operation… now x is 14, y is still 3
        System.out.println("x is " + x); // prints “x is 14”; concatenation
        x = x + 1; // sure! This symbol is “assignment”, not “equality”
        int x = 7; // no! can’t declare x once you’ve already done so; but x = 7 is fine
        m = 3; // no! can’t use m without first declaring it
        x = 5.5; // no! x is an int…. we’ll deal with this later
        int a = 5, b = 11; // declare and initialize two ints
        int c = a - b; // c is -6
        c = a * 2; // now c is 10
        c = 14;
        int r = c % 3; // remainder… r is 2
        int m = 18;
        int n = m / 3; // n is 6
        int k = 11 / 2; // k is 5, not 5.5!
        k = 3 / 4; // k is 0
    }
}

