Skip to content

Instantly share code, notes, and snippets.

@isauravmanitripathi
Created April 2, 2019 17:14
Show Gist options
  • Select an option

  • Save isauravmanitripathi/79472f0aff3212fb7b96f543428f7d65 to your computer and use it in GitHub Desktop.

Select an option

Save isauravmanitripathi/79472f0aff3212fb7b96f543428f7d65 to your computer and use it in GitHub Desktop.
public class variables {
public static void main(String [] arguments) {
int x, y, z; // x, y, and z are all declared
x = 42; // x is given the value of 42
y = x++; // y is given x's value which is 42 before it is incremented
// and x is then incremented to 43
z = ++x; // x is incremented to 44, and z is given x's value
System.out.println("x is: " + x);
System.out.println("y is: " + y);
System.out.println("z is: " + z);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment