Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

head first design patterns problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
What's that smell? Hey, sniff this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic