A Wetpaint Site
|
TV Fandex 100
Sign in to Wetpaint
Internet Explorer 6.0 is not supported. Please try
IE 8
or
Firefox
.
104javagroup
Home
Discussions
Photos
Videos
News
Updates
Droplets
Members
Sign in
or
Chapter8
Page Versions
Key:
additions
deletions
Please select two page versions to compare - check the checkbox to the right of each version.
Showing 4 pages
Date/Time
Made By
Edit Note
Type
Scope
Compare
Sep 20 2007, 5:00 AM EDT
swangs
edit
18 words added
Change:
advantage class a{ botten1.addActionListener( anomynous inner class.. ) ...}Disadvantages: May hard to be maintained or understanded by inexperienced programmer. Most develop tools come a bit little support inner classes.
考題:
第三,Static Nested Class 和 Inner Class的不同,說得越多越好。
Static Nested Class不能直接參考它的封裝類別(enclosing class)中的實
體變數或方法,僅能透過object instance的方式存取。
Inner Class可以直接存取它的封裝類別(enclosing class)中的變數或方法。
inner class中不能定義任何的static成員。
View changes from previous version.
(Word count: 140)
Sep 19 2007, 10:23 PM EDT
swangs
edit
59 words added
Change:
more
2.The organazation advantage
Package P
class OutClass
class a
class b
class InnerC
classd
...
3.The callback advantage
class a{
botten1.addActionListener(
anomynous inner class..
)
...
}
Disadvantages:
May hard to be maintained or understanded by inexperienced programmer.
Most develop tools come a bit little support inner classes.
View changes from previous version.
(Word count: 123)
Sep 19 2007, 6:47 AM EDT
swangs
edit
67 words added
Change:
Popcorn p = new Popcorn(){
public void pop(){
System.out.println("anomynous popcorn");
}
};
}
new Popcorn()後面沒接;,表示後面寫的是匿名內隱類別,如果Popcorn是實體類別,則該匿名內隱類別就是Popcorn的子類別,如果Popcorn是介面,則該匿名內隱類別就是implmenter,擴充該interface。
原來的;跑到內隱類別結束的大括號後面。
6.在引數宣告匿名內隱類別
class MyWonderfulClass{
void go(){
Bar b = new Bar(){
b.doStuff(new Foo() {
public void foof(){
System.out.println("foofy");
}
});
}
}
}
interface Foo{
void foof();
}
class Bar{
void doStuff(Foo f){}
}
View changes from previous version.
(Word count: 63)
Aug 22 2007, 6:35 AM EDT
jefflinweb
create
No content added or deleted.
Change:
Created by
jefflinweb
Aug 22 2007, 6:35 AM EDT for: no reason given
JavaScript must be enabled in order for you to contribute to this site.
To start contributing, enable JavaScript by changing your browser options, then
try again
.
Home
Chapter 1
Chapter 2
Chapter3
Chapter4
Chapter 5
Chapter6
Chapter7
Chapter8
Chapter9
Chapter10
Chapter11
Chapter12
new page
(Uncategorized)