+ 1

Why its giving error? And not increamenting x twice?

public class Program { public static void main(String[] args) { int x = 34; int y =(++ (++x)); System.out.println(y); } }

24th Mar 2020, 9:46 PM
Ana
4 Answers
+ 3
it because parentheses Mireille has right too
24th Mar 2020, 9:59 PM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
+ 2
hi, because first increment is ok inside (..(++x)) but second is (++35) the new value not (++x)
24th Mar 2020, 9:54 PM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
+ 1
Oneill.....but what's the reason?
24th Mar 2020, 9:56 PM
Ana
24th Mar 2020, 10:00 PM
Ana