这如何打破;语法在此Java守则中工作

发布于 2025-02-12 19:54:02 字数 1400 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

策马西风 2025-02-19 19:54:02

我在这一点上感到好奇的是该程序将开始
X到达6?

,立即立即说明

- >然后,该程序将用于整数内值3,
然后x变为9,y变为26。 x!= 6,如果无法执行条件,则x变为12

inner value 2 :

x = 15, y = 24 , x = 18 

inner value 1 : ( the for loop break ) 
x = 18 and y= 22

outer =1 : 

inner = 4, x = 24, y = 20 , 

inner = 3 , x = 30 , y =18 

inner = 2 , x = 36, y  = 16

inner = 1 ( won't executed ) 

 exits inner for loop 
x = 36, y = 14
outer= 2 ; 

inner = 4 : 
x = 42, y = 12
 
inner = 3 : 
x = 48 , y = 10 ; 

inner  =2 
x = 54, y = 8 
inner =1 : exits inner for loop 
x = 54 and y = 6 

thus the final values are x = 54, and y = 6 only 

What I am curious about at this point is will the program will start
the if statement right away as soon as x reaches 6?

-> The program will then run for integer inner value 3 ,
then x becomes 9 and y becomes 26 . x != 6 , if condition wont be executed then x becomes 12

inner value 2 :

x = 15, y = 24 , x = 18 

inner value 1 : ( the for loop break ) 
x = 18 and y= 22

outer =1 : 

inner = 4, x = 24, y = 20 , 

inner = 3 , x = 30 , y =18 

inner = 2 , x = 36, y  = 16

inner = 1 ( won't executed ) 

 exits inner for loop 
x = 36, y = 14
outer= 2 ; 

inner = 4 : 
x = 42, y = 12
 
inner = 3 : 
x = 48 , y = 10 ; 

inner  =2 
x = 54, y = 8 
inner =1 : exits inner for loop 
x = 54 and y = 6 

thus the final values are x = 54, and y = 6 only 

:

终止放荡 2025-02-19 19:54:02

if语句永远不会是正确的,因此我们可以忽略它,内部循环总共运行9次,每次添加6次 - > 9*6 = 54 = x
并提取2 9次= 18,外循环总共运行3倍,您还可以提取2 = 6。y = 30-18-6 = 6。不确定您的42来自何处,但为了澄清,请设置一些断点,然后在调试器中播放

The if statement will never be true so we can ignore it, the inner loop runs a total of 9 times where you add 6 each time -> 9*6=54=x
and substract 2 9 times = 18, outer loop runs 3 times total where you also substract 2 = 6. y=30-18-6=6. Not sure where your 42 comes from but for clarification just set some breakpoints and let it play through in the debugger

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文