0
HOW THIS OUTPUT X IS 14????
class HelloWorld { public static void main(String[] args) { int x=13; int y=++x; int z=x; System.out.println(z); } } RESULT 14
4 odpowiedzi
+ 2
you are incrementing the x value first then storing that in y that's why it's 14
+ 1
>>> int y=++x;
This line increments x by 1, so x becomes x+1(13+1) 14
+ 1
++ (Prefix increment), increment value first amd store in y. So value of x and y is still 14
- 1
To know more check the value type and references type in java. That will help