java:在pc上编译包时出错

pbossiut  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(213)

我在我的笔记本电脑上编译了一些java文件,现在我试着在我的电脑上打开它们,我只收到错误消息,这些包不起作用。f、 e.文件夹“webshop”中有两个文件:

package webshop;

     public abstract class Article {
        int artCode;
        float price;
        int stock;

        public void buy (int n) {
            stock += n;
        }

        public void sell (int n) {
            stock -= n;
        }

        public boolean available () {
            return stock > 0;
        }

        public String getDescription () {
            return "ArtNr. " + artCode + " €" + price;
        }

        public Article (int ac, float p) {
            artCode = ac;
            price = p;
            stock = 0;
        }
    }

package webshop;
import webshop.Article;

public abstract class Book extends Article {
    String author;
    String title;

    public String getDescription () {
        return getKind() + " '" + title + "' von " +
            author + "; " + super.getDescription();
    }

    public abstract String getKind ();

    public Book (int ac, float p, String a, String t) {
        super(ac, p);
        author = a;
        title = t;
    }

    public Book (int ac, String a, String t) {  // construct a free book
        super(ac, 0);
        author = a;
        title = t;
    }
}

现在,当我在我的pc上编译book.java时,我得到一个错误,即不存在“webshop”包,但在我的笔记本电脑上,它可以完全正常工作。有什么想法吗?这两个文件都位于名为webshop的同一文件夹中。问候

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题