import java.util.*; class WordStore { public WordStore(int n){ int number = n; } public String[] storewords = new String[number]; public int count=0; public void add(String word){ storewords[count] = word; count=count+1; }
I am not sure were to declare the String Array storewords, so i just made it public and the same with int count. I tried putting them in the constructor, but it wouldn't recognise the variable.
There are certain conditions I have to meet, like the method add is declared
public void add(String word)
and when add is callled it just stores a word in the array (theres another loop in another class that calls it, and i got to leave it unchanged.
The problem I am getting it doesn't recognise the variable number