Static referencing error
- by maxflow
public class HelloWorld {
public static void main(String [] args) {
char[] b = {'a', 'b', 'a', 'c'};
int p = 4;
deleteRepeats(b, p);
}
public void deleteRepeats(char[] a, int size) {
int currentElement;
currentElement = 0;
do {
for (int i = currentElement; i < size-1; i++) {
if (a[currentElement] == a[i+1]) a[i+1] = ' ';
}
currentElement++;
} while (currentElement < size-1);
}
}
I get the error:
non-static method deleteRepeats(char[],int) cannot be referenced from a static context deleteRepeats(b,p);
Can someone tell me what this means?
I tried removing "static" from the main method, but I get the error:
Exception in thread "main" java.lang.NoSuchMethodError: main.
Thanks in advance