Java编程问题 [英] Java programming question
本文介绍了Java编程问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
What will be the values of X and y after executing the following expressions:
int x=20,y=35;
x=y++ + x++;
y=++y + ++x;
我的尝试:
我发现X的值为55,y为57,但我不确定它是否正确。
What I have tried:
I have found the value of X as 55 and y as 57 but I'm not sure if it's correct.
推荐答案
Quote:
我发现X的值为55,y为57,但我不确定它是否正确。
I have found the value of X as 55 and y as 57 but I'm not sure if it's correct.
我同意55,但不是57.
当计算新y时,x已经改变了。
知道答案的简单方法是制作程序并执行。
I agree with 55, but not with 57.
When the new y is calculated, x have changed already.
The easy way to know the answer is to make a program and execute.
这篇关于Java编程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文