Topic: 如何理解执行的先后顺序 |
Print this page |
1.如何理解执行的先后顺序 | Copy to clipboard |
Posted by: 一枝梅 Posted on: 2005-06-08 11:46 class CCircle { double pi=3.14; double radius; void show_area(){ System.out.println("area="+pi*radius*radius); } void show_all(){ System.out.println("radius="+radius); show_area(); } } public class ex4 { public static void main(String args[]) { CCircle cir1=new CCircle(); cir1.radius=2.0; cir1.show_all(); } } 运行结果是: radius=2.0 area=12.56 为什么不反过来哟? |
2.Re:如何理解执行的先后顺序 [Re: 一枝梅] | Copy to clipboard |
Posted by: why Posted on: 2005-06-08 12:07 Why should it 反过来??? cir1.show_all(); is called System.out.println("radius="+radius); is executed show_area(); is called System.out.println("area="+pi*radius*radius); is excuted return to show_all return to main sigh... please use a debugger... I should have pointed to a section of the Java spec, but I don't think you would read it, so... |
3.Re:如何理解执行的先后顺序 [Re: 一枝梅] | Copy to clipboard |
Posted by: jfs771 Posted on: 2005-06-10 15:23 呵呵 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |