// in Store.java 
public class Store 
{
public Shoe hightop;

// public static void init()
// {
// hightop = new Shoe(); // 这行报错,Shoe不识认
// }

public Store() //构造函数
{
hightop = new Shoe();
}

public void main(String[] args)
{
// init();
getInfo(hightop);
orderInfo(hightop);

}

public void getInfo(Shoe item)
{
System.out.println("The Produce is made by :" + item.MAKER);
System.out.println("It eosts S" + item.getPrice(1) + 'n');
}

public static void orderInfo(Shoe item)
{
System.out.println("To order from" + item.MAKER + "call"+ item.PHONE+".");
System.out.println("Each item cost S" + item.getPrice(1));
}
}
// in Shoe.java
public class Shoe implements Produce
{
public int getPrice(int id)
{
return id==1?5:10; 
}
};//in Prodouce.java
public interface Produce 
{
static final String MAKER = "My Crop";
static final String PHONE = "555-555-333";
public int getPrice(int id); 
};

解决方案 »

  1.   

    //刚才还有些问题// in Store.java 
    public class Store 
    {
    public Shoe hightop;

    // public static void init()
    // {
    // hightop = new Shoe(); // 这行报错,Shoe不识认
    // }

    public Store() //构造函数
    {
    hightop = new Shoe();
    }

    public static void main(String[] args)
    {
    Store myStore = new Store();
    getInfo(myStore.hightop);
    orderInfo(myStore.hightop);

    }

    public static void getInfo(Shoe item)
    {
    System.out.println("The Produce is made by :" + item.MAKER);
    System.out.println("It eosts S" + item.getPrice(1) + 'n');
    }

    public static void orderInfo(Shoe item)
    {
    System.out.println("To order from" + item.MAKER + "call"+ item.PHONE+".");
    System.out.println("Each item cost S" + item.getPrice(1));
    }
    }
      

  2.   

    //in Produce.java
    public interface Produce 
    {
    static final String MAKER = "My Crop";
    static final String PHONE = "555-555-333";
    public int getPrice(int id); 
    };
    // in Shoe.java
    public class Shoe implements Produce
    {
    public int getPrice(int id)
    {
    return id==1?5:10; 
    }
    };
    // in Store.java 
    public class Store 
    {
    public static Shoe hightop;

    public static void init()
    {
    Shoe hightop = new Shoe(); // 这行报错,Shoe不识认
    }

    public static void main()
    {
    init();
    getInfo(hightop);
    orderInfo(hightop);

    }

    public static void getInfo(Shoe item)
    {
    System.out.println("The Produce is made by :" + item.MAKER);
    System.out.println("It eosts S" + item.getPrice(1) + 'n');
    }

    public static void orderInfo(Shoe item)
    {
    System.out.println("To order from" + item.MAKER + "call"+ item.PHONE+".");
    System.out.println("Each item cost S" + item.getPrice(1));
    }
    }
      

  3.   

    //in Prodouce.java
    public interface Produce 
    {
    static final String MAKER = "My Crop";
    static final String PHONE = "555-555-333";
    public int getPrice(int id); 
    };// in Shoe.java
    public class Shoe implements Produce
    {
    public int getPrice(int id)
    {
    return id==1?5:10; 
    }
    };// in Store.java 
    public class Store 
    {
    public Shoe hightop;
    〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉
    // public static void init()
    // {
    // hightop = new Shoe; // 这行报错,Shoe不识认
    // } public Store() //构造函数
    {
    hightop = new Shoe();
    }
    〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉
    〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉
    // public static void main() {
    // init();
    // getInfo(hightop);
    // orderInfo(hightop);
    //
    // }         public static void main(String args[]){
                      Store aStore = new Stroe();
                      aStore.getInfo(hightop);
                      aStore.orderInfo(hightop);
             }
    〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉
    public static void getInfo(Shoe item)
    {
    System.out.println("The Produce is made by :" + Shoe.MAKER);//被修改
    System.out.println("It eosts S" + item.getPrice(1) + 'n');
    }

    public static void orderInfo(Shoe item)
    {
    System.out.println("To order from" + Shoe.MAKERS + "call"+ item.PHONE+".");//被修改
    System.out.println("Each item cost S" + item.getPrice(1));
    }
    }楼主还要好好学习面向对象思想才好,从最简单的开始吧
      

  4.   

    public class Shoe implements Produce
    {
    public int getPrice(int id)
    {
    return id==1?5:10;
    }
    }// in Store.java 
    public class Store
    {
    public Shoe hightop; public void init()
    {
    hightop = new Shoe();
    } public static void main()
    {
            Store store = new Store();
    store.init();
    getInfo(store.hightop);
    orderInfo(store.hightop); } public static void getInfo(Shoe item)
    {
    System.out.println("The Produce is made by :" + item.MAKER);
    System.out.println("It eosts S" + item.getPrice(1) + 'n');
    } public static void orderInfo(Shoe item)
    {
    System.out.println("To order from" + item.MAKER + "call"+ item.PHONE+".");
    System.out.println("Each item cost S" + item.getPrice(1));
    }
    }public interface Produce
    {
    static final String MAKER = "My Crop";
    static final String PHONE = "555-555-333";
    public int getPrice(int id);
    }