I am doing a school project in java and I am trying, in a method, to refer to the class.
import java.util.ArrayList;
public class NumberIndex extends ArrayList<Integer> {
private int s;
public NumberIndex (){
super();
s = 10; // would be better if it was class.size()
//but I don't know how to refer to the class
}
public NumberIndex (int x){
super(x);
s = x;
}
public void addWord(int num) {
for(i = 0; i < s; i++)
//trying to make it so that for each Integer in ArrayList,
// if there exists an Integer that has the value num, nothing would
//happen. Else creates new Integer and adds it to the List
So in order for me to finish this code, all I need is a way to reference the class object NumberIndex itself.
Set<Integer>which is a collection without duplicates and you would be better off not having ansvalue and it can only bring your grief.statickeyword. You can reference the actual class object withNumberIndex.class.