My class object is not loading for some reason. I've made 3 methods in the second class and I'm trying to use them in the first class, but I'm getting exception errors. Here's my first class:
public class MyFish extends Panel implements Runnable, KeyListener {
public static void main(String args[]) {
EFish.loadEFish(EFish.eFish); // load the EFish objects
EFish.loadEFishThread(EFish.eFishThread); // load the EFish threads
EFish.startEFishThread(EFish.eFishThread); // start the EFish threads
}
}
Here's my second class:
public class EFish implements Runnable {
static EFish eFish[] = new EFish[20];
static Thread eFishThread[] = new Thread[20];
static void loadEFish(EFish i[]) {
for (int j = 0; j < i.length; j++) {
i[j] = new EFish();
}
}
static void loadEFishThread(Thread i[]) {
for (int j = 0; j < i.length; j++) {
i[j] = new Thread();
}
}
static void startEFishThread(Thread i[]) {
for (int j = 0; j < i.length; j++) {
i[j].start();
}
}
}
Here's the exception error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method loadEFish(EFish[]) is undefined for the type EFish
eFishThread cannot be resolved or is not a field
eFishThread cannot be resolved or is not a field
at fishy.MyFish.main(MyFish.java:103)