Topic: 初级问题:try是不是只能在方法中使用? |
Print this page |
1.初级问题:try是不是只能在方法中使用? | Copy to clipboard |
Posted by: Raistlin Posted on: 2004-05-28 14:02 是不是try只使用在方法中,不能在class中直接使用,如下: public class Text { try { }catch(...){} } 改变对象的属性是不是也只能在方法中使用,如: jLabel1.setText = aaa; 谢谢! |
2.Re:初级问题:try是不是只能在方法中使用? [Re: Raistlin] | Copy to clipboard |
Posted by: seeker_zyf Posted on: 2004-05-28 14:40 可以在类里用,不过得在static语句里用,这样类初始化时就会调用。 例如: static { any code here, but please refer to only static member. } |
3.Re:初级问题:try是不是只能在方法中使用? [Re: Raistlin] | Copy to clipboard |
Posted by: qingbo777 Posted on: 2004-05-28 16:00 问问题都问错了....... 不是方法,是对象吧. |
4.Re:初级问题:try是不是只能在方法中使用? [Re: Raistlin] | Copy to clipboard |
Posted by: Raistlin Posted on: 2004-05-28 16:48 楼上的可能是没理解我的意思 to seeker_zyf:3x |
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 |