Baidu Interview Question
Software Engineer / DevelopersFirst i++ and ++i are the same since they do the same operation. But the results are not in the same time. With i++, we return the value contained in the variable i before increment it. And ++i, we increment i and we return the value of i. What would happen if in for loop in java we would do something like
for(int i = 0; i < size; ++i) { .... }
When i is a user defined type
- Anonymous August 02, 2011And you look at implementation of both i++ and ++i and decide that one of them is written better than other