I'm using eclipse to make my java programs now, but I need to override the equals method so it will take the actual data and not the name or id. When I try to auto-make it like I know how to, it says I have no non-static variables. I added some in and it still doesn't work. I don't know enough about java to do it myself but I know enough that I would most likely understand what you are talking about. (I'm not done with my code, i just started.)(The integers y and x were just to try to make it work) And if you are wondering, i'm trying to make something to run through the alphabet and find any word you put in.
package mainPackage;
import java.util.*;
public class Main extends Creater{
public static void main(String[] args) {
int x = 0;
int y = 0;
thatInput = Inputs.ask();
Loops.CreateArray();
}
}
package mainPackage;
import java.util.*;
public class Creater {
static String thatInput;
static String theInput;
static String[] First;
}
package mainPackage;
import java.util.*;
public class Inputs extends Creater {
public static String ask() {
Scanner in = new Scanner(System.in);
System.out.println("Type it in.");
theInput = in.nextLine();
return theInput;
}
}
package mainPackage;
import java.util.*;
public class Loops extends Creater{
public static String[] CreateArray(){
for(int i = 0; i<=Inputs.theInput.length(); i++){
First[i] = Character.toString(theInput.charAt(i));
}
return First;
}
}
the other is just an array with the alphabet in it.
Aucun commentaire:
Enregistrer un commentaire