Answers for "difference i++and ++i java"

2

java difference ++i and i++ loop

//no difference in a loop.
for (int i = 0; i < 100; i++) {
}

for (int i = 0; i < 100; ++i) {
}
//however when doing:
int a = 0;
int b = a++; // b = 0; a = 1

a = 0;
b = ++a; // b = 1; a = 1
Posted by: Guest on June-15-2020
3

++i vs i++ java

int a = 0;
int b = a++; // b = 0; a = 1

a = 0;
b = ++a: // b = 1; a = 1
Posted by: Guest on November-25-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language