Quick actions

cmd+k|ctrl+k

Navigation

Languages

Variables in Java

Snippet info

Language

Java

Visibility

public

Author

doug

Created

2016-07-20T19:07:27Z

Updated

2016-07-20T19:07:27Z

class Main {
    public static void main(String[] args) {
        // set three variables 
        int x = 0;
        int y = 123;
        int z = 321;
        
        // read the value of x
        System.out.println("x is: " + x);
        
        // change the value of x
        x = 25;
        
        // output the changed value of x
        System.out.println("x is now: " + x);
        
        // update the value of x by reading the values of y and z and adding them together
        x = y + z;
        
        // output the final value for x
        System.out.println("x is finally: " + x);
    }
}
INFO