/******************************************************************************
*  Example of declare and assign values to variables                         
******************************************************************************/
public class assign 
{
    public static void main(String[] args) 
    {
        int num;                                //declare an int variable
        num = 123;                              //assign a number to it
        System.out.println("int:    " + num);   //print it
    
        num = 7894532;                          //change the value
        System.out.println("int:    " + num);   //print it again

        long num2;                              //declare a long variable
        num2 = 1234567890;                      //assign it an int 
        System.out.println("long:   " + num2);  //no problem (int can fit in a long)

        num2 = 1234567890123456L;               //notice the L 
        System.out.println("long:   " + num2);  //print it again

        double num3 = 9865917.1234;             //declare & initialize a double
        System.out.println("double: " + num3);  //print it

        num3 = 9865917208473252.765032;         //change the value
        System.out.println("double: " + num3);  //print it

        float num4 = 654321.91F;                //notice the F for float
        System.out.println("float:  " + num4);  //the F is required
                                                //otherwise the constant 
                                                //will be a double
                                                //java will not demote 

        char letter = 'a';                      //declare and init a char
        letter = 'A';                           //change the value
        System.out.println("char:   " + letter);

        boolean OK, notOK;                      //declare 2 boolean vars
        OK    = true;                           //set it to true
        notOK = false;                          //set is to false
        System.out.println("boolean " + OK + " " + notOK);

        String str = "Sam";                     //declare a String
        System.out.println("String: " + str);

        //---------------------------------------------------------------
        //Using the var datatype, Java will determine the datatype
        //---------------------------------------------------------------
  
        var x = 3;   
        System.out.println("var:    " + x + "\t will be created as an int");
        var y = 3.14;   
        System.out.println("var:    " + y + "\t will be created as a double");
        var z = "Sam";   
        System.out.println("var:    " + z + "\t will be created as a String");
    }
}