+ 1
public class Program { public static void main(String[] args) { int x = 34; int y = ++x; int z = x+y
while output is 70? not 69?
4 Réponses
+ 2
Daniel you probably figured this out already, the below is just a breakdown for newbies scrolling through 😊
int x = 34 >> x = 34
int y = ++x >> x = 34 + 1
>> x = 35
>> y = 35
int z = x + y >> z = 35 + 35
>> z = 70
+ 1
becaus ++x means increase the value of x by one AND THEN put it in y
+ 1
yes, of course. i have already guessed:) Thank you
+ 1
Daniel got it =70