Java.util.Arrays为NULL

时间:2016-10-23 23:54:19

标签: java arrays null

所以我正在进行我的CS项目,我们需要按照导演对DVD列表进行排序。 它会编译,但是当我运行它时我得到一个null(在java.util.Arrays中) 我叫做java.text.numberformat和java.util。* 是我忘了在我的进口中添加任何东西? 谢谢朋友们。

 public void addDVD(String title, String director, int year, double cost, boolean bluray)
{
    DVD newDvd = new DVD(title, director, year, cost, bluray);
    int index = Arrays.binarySearch(collection, newDvd);
    if(index >= 0) {
        System.out.println("DVD with title " + newDvd.getTitle() + " already exists.");
    }
    else {
        int index1 = -index - 1;
        collection = insertDVD(collection, newDvd, index1);
        System.out.println("DVD with title " + newDvd.getTitle() + " added.");
    }
    totalCost += cost;
}

0 个答案:

没有答案