+ 1
Can someone clearly explain variables and changing its value after assigning a value in the codes_int x =3, int y=4 , y=x!?!?!?
variables and values
4 ответов
+ 2
Variables are like buckets.
When you assign a value to the variable you put something into the bucket.
In your case I will explain it with apples as int
you put 3 apples into your bucket. x that is x=3
then you put 4 apples into bucket y that is y=3
then you put all apples out of bucket y and you copy the number of apples out of x and put them in bucket y. that is y=x
+ 2
int x = 3 (you defined a new variable of type integer with an initial value of 3)
int y = 4 (you created another variable of type integer with an initial value of 4)
y = x (you assigned the value of x into y, which changes the value of y from 4 to 3)
+ 1
x == 3 and y==3
0
akc that means now ×=? , y=? what are the actual values now for x and y?