Hi Sonu, tyr with the below and run the application. 1) take the driver program(food.java) out of the foodpackagefruitpackage package. 2) remove package foodpackagefruitpackage; from food.java 3) Import the food class (import foodpackagefruitpackage.food;) in food.java file Regards, Raj
K Srinivasa Raju --- On Sat, 11/7/09, Sonu Mittal <[email protected]> wrote: From: Sonu Mittal <[email protected]> Subject: [java programming] whats the error in th code To: "Free Java Programming Online Training Course By Sang Shin" <[email protected]> Date: Saturday, 11 July, 2009, 2:55 PM I have 2 files namely food.java and foodmain.java both files' code is given below. FOODMAIN.java package foodpackagefruitpackage; public class foodmain { public foodmain(){} public static void main(String []args){ int price; food d=new food(); d.food("apple"); d.food(10); price=d.getprice(); System.out.println(price); //System.out.println(d.getprice()); } } FOOD.java package foodpackagefruitpackage; public class food { public food(){} public String name; public int price; public void food(String nm){ this.name=nm; } public void food(int pr){ price=pr; } public String getname(){ return name; } public int getprice(){ return price; } public static void main(String[] args) { } } I am suing netbeans. Netbeans neither show any error nor show output. tell me whats the error. New Email names for you! Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does! http://mail.promotions.yahoo.com/newdomains/aa/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
