Skip to content

Instantly share code, notes, and snippets.

@tedheich
Created November 18, 2009 08:06
Show Gist options
  • Save tedheich/237645 to your computer and use it in GitHub Desktop.
Save tedheich/237645 to your computer and use it in GitHub Desktop.
Shows the effect of postfix and prefix increment operator in Java
class IncDec {
public static void main(String []args){
int a = 0;
int b = 0;
int x = a++;
int y = ++b;
System.out.println("Value of a = " + x);
System.out.println("value of b = " + y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment