2

Possible Duplicate:
explain working of post and pre increment operator in Java
What is the difference between int++ and ++int?

In Java, what is ++int? What does it do? What does it mean?

(Sorry, but I didn't ask the question correctly last time.)

Community
  • 1
  • 1
user1260584
  • 149
  • 2
  • 3
  • 8

3 Answers3

6
a = 5; b = ++a; // a = 6, b = 6
a = 5; b = a++; // a = 6, b = 5
iehrlich
  • 3,572
  • 4
  • 34
  • 43
2
int a=1;
System.out.println(a++);

prints "1"

int a=1;
System.out.println(++a);

prints "2"

Or maybe i don't understand your question.

KostaPC
  • 614
  • 6
  • 2
1

++int increments int by 1 before and int++ increments by one after

Chuck Norris
  • 15,207
  • 15
  • 92
  • 123
chadpeppers
  • 2,057
  • 1
  • 20
  • 27