File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes head first design patterns problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "head first design patterns problem" Watch "head first design patterns problem" New topic
Author

head first design patterns problem

dick kromkamp
Greenhorn

Joined: Sep 28, 2008
Posts: 2
Hello everybody,

I started to read the book 'head first design patterns', but
I already got a problem.




I want to compile this code, but then it said:



How do you compile this?

greetz
[ September 29, 2008: Message edited by: dick kromkamp ]
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
The book gives only that part of the code that is necessary to make the reader understand the concept.The fly() etc. methods are a "don't care" vis-a-vis driving the concept home.
However, since you have raised this question, it makes me think that may be you are jumping ahead of yourself by reading Design Patterns. May be you should read Java basics first.
dick kromkamp
Greenhorn

Joined: Sep 28, 2008
Posts: 2
That's not true,
I only posted a part of the code on page18.
The fly() methods etc are in the FlyBehavier and QuickBehavier.
Anyone can help who had read this book?

[ September 28, 2008: Message edited by: dick kromkamp ]
[ September 28, 2008: Message edited by: dick kromkamp ]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3026
    
    4

Originally posted by dick kromkamp:
That's not true,
I only posted a part of the code on page18.
The fly() methods etc are in the FlyBehavier and QuickBehavier.
Anyone can help who had read this book?

[ September 28, 2008: Message edited by: dick kromkamp ]

[ September 28, 2008: Message edited by: dick kromkamp ]


So if fly() is part of the FlyBehavior object, how do you think you should call the fly() method from that object? As a hint, the code you posted IS NOT the code that is on page 18 of the book. You screwed up copying it. Can you see where? If you had a solid knowledge of Java Basics, as has previously been suggested, you should have been able to see the error right away.
[ September 28, 2008: Message edited by: Steve Luke ]

Steve
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: head first design patterns problem
 
Similar Threads
I'm probably overlooking something very stupid...
Polymorphism is the deebil
Did I make the Strategy pattern unnecessarily complicated?
Problem with Head First Design Patterns code
Handle and Request Method Naming Conventions