找不到或加载主类,但肯定有一个主类

时间:2018-10-02 23:18:37

标签: java

我在Intellij上很好地处理了我的项目,但是现在我将其导入以使其黯然失色,它一直在说“找不到或加载主类错误”,这是我的代码。肯定有一个主班。我觉得它没有运行正确的程序。以前,MH的问题是我无法在包资源管理器中选择它,因为它不在那儿,而现在它在那儿,但是我无法运行该程序,因为eclipse表示没有主类。

这是我的主班

import java.util.Collections;
import java.util.LinkedList;
import java.util.Iterator;
public class GoneFishin {
    public static void main(String[] args) {
        //create linked list of fish data called fl
        LinkedList<FishData> fl = new LinkedList<FishData>();
        //Here are a few data items
        fl.add(new FishData("American Eel ", 9, "Summer/Spring ", 25, false));
        fl.add(new FishData("Hammerhead Shark ", 0, "All Year ", 36, false));
        fl.add(new FishData("Horseshoe Crab ", 7, "All Year except May ", 60, false));
        fl.add(new FishData("Haddock ", 18, "All Year ", 0, true));
        fl.add(new FishData("Tautog ", 16, "late Spring to end of year ", 3, true));

        for (FishData element : fl) {
            System.out.println(element);
        }
        System.out.print("SIZE OF LISTt: ");
        System.out.println(fl.size());

        System.out.print("SECOND ELEMENT IN LIST: ");
        System.out.println(fl.get(1));

        System.out.print("LAST ELEMENT IN LIST: ");
        System.out.println(fl.getLast());

        Iterator<FishData> itr2 = fl.iterator();

        System.out.println("PRINTING ALL ELEMENTS USING ITERATOR");
        while (itr2.hasNext()) {
            System.out.println(itr2.next());
        }
        Iterator<FishData> itr = fl.iterator();
        while (itr.hasNext()) {
            FishData b = (FishData) itr.next();
            if (b.getWillEat()== false) {
                itr.remove();
            }
        }
        System.out.println("FISH THAT ARE GOOD TO EAT");
        for (FishData element : fl) {
            System.out.println(element);
        }
    }
}

0 个答案:

没有答案