广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 2377 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
s9005034 手机
个人文章 个人相簿 个人日记 个人地图
初露锋芒
级别: 初露锋芒 该用户目前不上站
推文 x0 鲜花 x14
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[Java] Inner class 的问题?
class InnerSuper{protected int x=1;}
class OuterSuper{protected int y=2;}
interface ForPolymor{void f();}
class Test extends OuterSuper{
private int z=3;
public ForPolymor g(){
final int i=4;
int j=5;
class Inner extends InnerSuper implements ForPolymor{
int k=6;
public void f(){
int m=7;
System.out.println(x);//因为In ..

访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容



献花 x0 回到顶端 [楼 主] From:台湾中华电信 | Posted:2005-08-01 11:02 |
PeterPan 手机
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖
知名人士
级别: 知名人士 该用户目前不上站
推文 x1 鲜花 x99
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

定义于某 class 的某个 method 内的 inner class,称为 local inner class,性质跟区域变数一样,只能在该 method 内使用,无法在其他地方直接建立其 object。
local inner class 只能取用外部 class 中,以 final 宣告的变数。
ForPolymor fp=t.g(); ←﹝由于g()这个 method 的回传型别为 ForPolymor,注意看它最后三行的程式码为Inner in=new Inner(); in.f(); return in; 所以这样写就能接到该 local inner class 的 object,接下来才能呼叫该 class 的 f() method﹞

=以上若有谬误请大力纠正=


神:在多项技术领域,具有不可取代性且拥有高度权威
魔:在某项技术领域,具有不可取代性且拥有高度权威
妖:有高度实战经验,且在专业领域上具有domain-Knowledge
侠:在技术层面上有过人专业能力
人:可以独立运作、设计暨开发系统
虫:coder only (my level)
献花 x0 回到顶端 [1 楼] From: | Posted:2005-08-05 17:03 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.014773 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言