• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot make java find the symbol  RSS feed

 
Ranch Hand
Posts: 52
1
Chrome MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get a "Cannot Find Symbol" error on this script


But the compiler says I can't find the symbol Dough, Sauce ect
So I say Ok I don't know what objects I want these to point to yet so I will define them as null objects

The compiler says thanks for those declarations they are all legal
by the way I can't find the symbol Dough, Sauce ect
So I say Ok I will make Dough point to an actual object if that will make you happy

And the compiler says your new declaration is quite legal
by the way I can't find the symbol Dough, Sauce ect
And I say stuff you compiler im going to watch some funny stuff on youtube
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say:

That says it's going to have a return type of Dough. So there needs to be a class (or interface) called Dough. You've tried to fix it by creating a variable called Dough, but that's something else entirely.

If Dough, Sauce etc are just supposed to be instances of the class Ingredient, then your CreateXxx() methods need to be declared to have Ingredient as a return type (which again needs to be declared somewhere).
 
Stephen Black
Ranch Hand
Posts: 52
1
Chrome MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So If I am using a factory pattern or any programming method where a returned object type is not known
I must use the super type as the return type
Get it
It works
Yay
Thanks
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is something wrong with your design of pizza classes, but haven’t got the time to go through it in detail now. Please post the complete code.
 
Stephen Black
Ranch Hand
Posts: 52
1
Chrome MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mention before something about pizza type being cheese
Some people like cheese pizzas apparently its pizza with sauce and cheese
Not my idea of a good pizza though but my pretend java pizza shop sells them

Campbell Ritchie wrote:I think there is something wrong with your design of pizza classes, but haven’t got the time to go through it in detail now. Please post the complete code.

 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen Black wrote:Not my idea of a good pizza though but my pretend java pizza shop sells them

Why pretend? Why not try to model the thing accurately, but start out with a limited number of options?

What happens when you go into a pizza joint?

Chances are that you will have "Pizza" on the menu, and then a whole bunch of optional toppings and sauces that you can add to a plain pizza to make the final product.

One thing I'd suggest is to look at enums - extremely useful for this sort of problem. They can also implement interfaces (Topping?/Ingredient?), and so can make good factories.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!