Hi i'm a beginner to java and i'm having trouble understanding how classes work. Could someone help by telling me where i went wrong, and how I could fix it. Thanks :)
public class test {
public static String[] q;
public static int count =0;
public static void addString(String text) {
q[count] = (text);
count++;
}
public static void main (String [] args) {
addString("Test");
addString("Test2");
for (String array: q) {
System.out.println (array);
}
}}