Defining variables


public class variable {

    public static void main (String[] args)
    {
        System.out.println("Hello this is the example of printing variables");
        int my_first_intvar=(10 + 20)/(4);          
       
    // we can define a expression
        int seco;
        seco =10;
        int thr;
        thr=20;
        int mytot=1000- (my_first_intvar+seco+thr);  //variable should use camelCase
               
        System.out.println("Hi the value in the variable is " + mytot);//variable printing must be done without quotes
    }
}

Comments