Topic: 菜鸟提问:是不是每个main()方法都要用static来修饰?

  Print this page

1.菜鸟提问:是不是每个main()方法都要用static来修饰? Copy to clipboard
Posted by: xmingh
Posted on: 2005-08-30 15:30

如果是,为什么要这样?
如果不是,什么情况下要这样?

2.Re:菜鸟提问:是不是每个main()方法都要用static来修饰? [Re: xmingh] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-08-30 18:20

Yes, since it is for the entrance of the entire application.

No, since you can define one without static, but also make yourself confused, and the main() without static can not used for the same purpose. Please stop doing that!!!!!!

Something is legal does not mean it is recommanded!!!!!!

Don't trouble troubles until trouble troubles you!!!!

3.Re:菜鸟提问:是不是每个main()方法都要用static来修饰? [Re: xmingh] Copy to clipboard
Posted by: hxz5830
Posted on: 2005-08-30 18:27

肯定是。
程序执行时,首先要找main方法并从此执行。非static方法都要对象调用才行,程序一开始肯定没有main方法所在类对象,只有把main方法定为static,才能保证不用任何对象就可执行。

4.Re:菜鸟提问:是不是每个main()方法都要用static来修饰? [Re: xmingh] Copy to clipboard
Posted by: angelstx
Posted on: 2005-08-30 23:04

回答的厉害

5.Re:菜鸟提问:是不是每个main()方法都要用static来修饰? [Re: xmingh] Copy to clipboard
Posted by: xmingh
Posted on: 2005-09-01 08:41

谢谢各位的回答!!

6.Re:菜鸟提问:是不是每个main()方法都要用static来修饰? [Re: xmingh] Copy to clipboard
Posted by: quiet
Posted on: 2005-09-04 11:29

支持hxz5830


   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