maybe this.name = foodName;
------ Respectfully, Alex --- On Mon, 9/28/09, Kazeem Akinbola <[email protected]> wrote: From: Kazeem Akinbola <[email protected]> Subject: [java programming] Re: help for Lab-1003 To: [email protected] Cc: [email protected] Date: Monday, September 28, 2009, 4:08 AM Hello, You did not declare any method in the FoodMain class. You must instantiate the Food class in a method, as that homework is concerned it must be in the main() method Implement your FoodMain.java as: package foodpackage.fruitpackage; public class FoodMain { public static void main(String args[]){ Food myFood = new Food(); myFood.setName("dsfa"); //System.out.println(""); } } On Mon, Sep 28, 2009 at 3:44 AM, yongchun gao <[email protected]> wrote: Hello, Can someone help me to figure out what the problem is? I have two classes: Food and FoodMain as below. the error I got is: ----------------------------------------------------------------------- package myFood does not exist <identifier> expected illegal start of type ----------------------------------------------------------------------- Food.java package foodpackage.fruitpackage; public class Food { // Declare instance variables. private String name; public Food(){ } public Food (String foodName) { name = foodName; } public String getName() { return name; } public void setName(String temp ) { name =temp; } } FoodMain.java package foodpackage.fruitpackage; public class FoodMain { Food myFood = new Food(); myFood.setName("dsfa"); //System.out.println(""); } Thanks -- Kazeem Akinbola Developer Itex Integrated Services Ltd 21, Olosa Street, V.I Lagos, Nigeria. +2348034893236 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
