Java

public class NewClass {
public static void main(String[] args) {

int i = 0, j=0, c=0;
i=i++;
j=i++;
System.out.println("i="+i+"j=" + j);
}
}
// prints out i=1 j=0

halp!

Attached: 1537916112847.jpg (891x888, 56K)

I think you're missing a +.

Scratch this. I'm wrong.

do i need to poo in the loo before i can understand incrementing and java?

This is not unique to Java Pajeet. If you do this in C you will get the same result.

bump
why do the things do what they do?

Attached: th.jpg (191x167, 7K)

>i=i++
increase i by one, then set i to the value it was before getting incremented, so i=0 after this line
>j=i++
increase i by one and then set j to the value i was before getting incremented, so j=0, i=1

why doesnt j become 1 after i has been incremented. no bully

Because i is 0 at that point Rajeet

Attached: 3Q9P.gif (200x150, 497K)

Itt
Scrubs who failed the OCP exam

Attached: 1EBF2743-F352-4242-8885-78E7A36C4CA7.jpg (586x605, 56K)

so its almost like a trick question. ill mull it over some more. thanks

"Woof Woof!"

it's probably meant to show off the difference between ++i and i++

not yet

Attached: Oracle.jpg (1024x951, 154K)

seeing the i++ twice like that you would just think i should equal at least one by the end. but yeah im pretty dumb. :p

youre speaking japanese to me friend

is that doge html? i think i get it now. it all makes sense

I misread the question.

I thought it was j=j++

So fucking stupid. It totally makes sense why it prints that.

>but yeah im pretty dumb. :p
don't worry about it, I've seen people cry because they couldn't grasp what booleans are or how they work. Not even kidding.

Good thread

confused me a bit

yeah i did some teaching positions at a coding bootcamp. i watched a black girl sit on the floor crying over some beginner python coding stuff. good times.