[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[Ant Documentation]
Back to Polymorphism (1). On to Polymorphism (2).
Held: Wednesday, 1 September 2004
Summary: Today we explore the basics of packages (and the related import statement) in Java.
Related Pages:
Notes:
Overview:
duplicateMe or refill.
GumballMachine).
getClass.
getConstructor.
CandyMachine bigcm = new BiggerCandyMachine((lambda () (new ChickletMachine()));
CandyMachine bigdcm = new BiggerCandyMachine((lambda () (new DoubledMachine(new ChickletMachine()))));
public class BiggerCandyMachine {
...
public BiggerCandyMachine(Function construct)
{
this.makebase = construct;
}
...
private CandyMachine newMachine() {
return construct();
} // newMachine
...
}
Abstract Factoryproblem and build a
CandyMachineFactory.
So, what did you do with the factory problem?
new Constructor() {
NewAndOverridenMethods
}
PrintWriter pen = new PrintWriter(System.out, true) {
public void println(String whatever) {
super.println("*** " + whatever + " ***");
}
};
CandyMachineTester cmt = new CandyMachineTester(
new BiggerCandyMachine(
new CandyMachineFactory() {
public CandyMachine build()
{
return new DoubledCandyMachine(
new ChickletMachine());
}
}));
Back to Polymorphism (1). On to Polymorphism (2).
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[Ant Documentation]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Dec 6 08:49:58 2004.
The source to the document was last modified on Tue Aug 31 22:20:35 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS223/2004F/Outlines/outline.03.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby