Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » Java与OOP初步  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:【请教】关于this的理解!! [Re:prettyxx]
mofeelsc





发贴: 5
积分: 0
于 2004-12-06 11:09 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我也是新學java不久﹐this 我是這樣理解的:
class A{
int flag;
public A(){
this(0);
}
public A(int flag){
this.flag = flag;
}
}
上面代碼中"this(0)"它其實就是public A(int flag)這個構建器吧﹗我想是因為這兩個構建器一個有參數一個無參數但構建器名字相同﹐如果你想在無參數中使用有參數的構建器你總不能使用A(0);吧﹖所以才會有this這個方法﹐不知理解對否﹖




话题树型展开
人气 标题 作者 字数 发贴时间
43169 [精华] 【请教】关于this的理解!! prettyxx 283 2004-12-03 17:41
40021 Re:【请教】关于this的理解!! ww1ww1 376 2004-12-04 09:56
39602 Re:【请教】关于this的理解!! prettyxx 144 2004-12-04 12:17
39442 Re:【请教】关于this的理解!! prettyxx 245 2004-12-06 01:48
39484 Re:【请教】关于this的理解!! mofeelsc 246 2004-12-06 11:09
39451 Re:【请教】关于this的理解!! 九佰 56 2004-12-06 12:57
39741 Re:【请教】关于this的理解!! gechun0214 105 2004-12-06 13:12
39482 Re:【请教】关于this的理解!! ww1ww1 197 2004-12-07 00:12
39348 Re:【请教】关于this的理解!! snowolf128 19 2004-12-07 08:39
39417 Re:【请教】关于this的理解!! ww1ww1 57 2004-12-07 18:08
38995 Re:【请教】关于this的理解!! hxy101015 21 2005-01-03 16:16
39333 Re:【请教】关于this的理解!! 鸡肋男 309 2005-01-04 10:18
39535 Re:【请教】关于this的理解!! ww1ww1 57 2004-12-04 13:01
39564 Re:【请教】关于this的理解!! prettyxx 144 2004-12-04 13:32
39436 Re:【请教】关于this的理解!! jigsaw 0 2004-12-04 13:09
39592 Re:【请教】关于this的理解!! ww1ww1 0 2004-12-04 13:16
39584 Re:【请教】关于this的理解!! prettyxx 63 2004-12-04 13:46
39702 Re:【请教】关于this的理解!! ww1ww1 434 2004-12-04 17:51
39610 Re:【请教】关于this的理解!! ww1ww1 278 2004-12-04 17:57
39637 Re:【请教】关于this的理解!! prettyxx 275 2004-12-04 22:18
39883 Re:【请教】关于this的理解!! ww1ww1 478 2004-12-05 00:19
39982 Re:【请教】关于this的理解!! prettyxx 805 2004-12-05 00:41
39804 Re:【请教】关于this的理解!! prettyxx 471 2004-12-07 16:05
40068 Re:【请教】关于this的理解!! ww1ww1 1126 2004-12-05 10:11

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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