Incrementation

M

Max

Is there a way to increment by more than one in Java? I know it can be
done in C (as I read a book about it, haven't actually used it), but I
can't find anything about it in Java.
 
M

Max

Never mind, I figured it out.

If you find this thread years later thinking that it'll have an
answer, try i += n, where i is what is incrementing and n is the
amound. Decrement is similar, use -=
 
L

Lars Enderin

Max skrev:
Is there a way to increment by more than one in Java? I know it can be
done in C (as I read a book about it, haven't actually used it), but I
can't find anything about it in Java.
Like in C: Use +=

foo = foo + anything;
is equivalent to
foo += anything;

int foo = 17;
foo += 99;
 
M

Max

An explaination that makes more sense than mine. Ignore my
explaination. It doesn't exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top