++x is called preincrement while x++ is called postincrement.
int x = 5, y = 5;
System.out.println(++x); // outputs 6
System.out.println(x); // outputs 6
System.out.println(y++); // outputs 5
System.out.println(y); // outputs 6
More Related Contents:
- What is the difference between += and =+?
- What will be the working of this statement in program of java? [closed]
- Difference between >>> and >>
- Why does this go into an infinite loop?
- Java: What does ~ mean
- The difference between += and =+
- What is the Java ?: operator called and what does it do?
- What does the ^ operator do in Java?
- Use of “instanceof” in Java [duplicate]
- Why is “extends T” allowed but not “implements T”?
- What is a Question Mark “?” and Colon “:” Operator Used for? [duplicate]
- What does “|=” mean? (pipe equal operator)
- Is there a difference between single and double quotes in Java?
- Java for loop syntax: “for (T obj : objects)”
- WITH statement in Java
- Java operator precedence guidelines
- Is it possible to make anonymous inner classes in Java static?
- Java “?” Operator for checking null – What is it? (Not Ternary!)
- In Java, can I define an integer constant in binary format?
- Any Java libraries out there that validate SQL syntax? [closed]
- what is the difference between == operator and equals()? (with hashcode() ???)
- Modifier Keyword order in Java
- Why is declaration of the variable required inside a for-each loop in java
- What does the colon (:) operator do?
- Why is this Java code in curly braces ({}) outside of a method?
- What’s the difference between this and Activity.this
- What does a tilde in angle brackets mean when creating a Java generic class?
- When would you put a semicolon after a method closing brace?
- Java Increment / Decrement Operators – How they behave, what’s the functionality?
- My java code has an obvious error. Why does it compile and run?