Hello, I'm getting "Meat unresolved" message in compiler with the following bit of code. Meat is the name of another class in the same project, just don't know why it can't resolve the class name.
Code:
public Pantry(){
List<Garnish> garnishes= new ArrayList(10);
List<Sauce> suaces= new ArrayList(10);
List<Meat> meats= new ArrayList(10);
orderFood(Meat, 10);
orderFood(Garnish, 10);
orderFood(Sauce, 10);
}
Thanks for the help
11-08-2006, 04:17 AM
marble
i will help you ;-)
ok try to use qualified class names.... put the whole path infront of the class' name like
java.util.HashMap<java.lang.String, java.lang.String> testMap = new java.util.HashMap<java.lang.String, java.lang.String>()
maybe you have forgotten to import it? in the same project doesn't mean necessarrily mean that it's in the same package - so if you have it in another package...?
another reason is the visibility of your class Meat... more code about the meatclass and maybe your package structure would surely be helpful!
11-08-2006, 04:46 AM
Red_Jester
All the classes in the project are in the same package, the problem is not restricted to the Meat class all the classes are giving the samer error. Am I just not passing the argument correctly? I'm trying to pass the class name to a method. However when I use the class name in a generic for a List it doesn't show the error, for this List<Meat> meats= new ArrayList(10)
11-08-2006, 05:08 AM
marble
please send the code - i will find out, fix it and give an answer to the problem in this forum -> send it to moccamixer@web.de
11-08-2006, 11:55 AM
Red_Jester
OK, I sent the code, thanks for the help.
11-08-2006, 01:01 PM
marble
ok... you cannot hand over the actual class to your "public void orderFood (Class foodType, int numItems) you have to hand over "orderFood(Meat.class, 10);" instead of just Meat. btw: you forgot to send me the sauce and the delicious garnish... did that solve your problems? i hardly took a look at your code, cause i guess this was what you needed (if not please tell me), but i would advice you to keep to the standards and name your packages in lower case manner. hope i was right with my quick guess.