I am trying to declare strings at the top of my main method and then print them in another method. This is the first code in main
public static void main(String[] args)
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = new String() ;
boolean pb = true;
int xc = 0;
int yc = 0;
String[] items = new String[10];
items[0] = "health potion";
items[1] = "";
items[2] = "-";
items[3] = "-";
items[4] = "-";
items[5] = "-";
items[6] = "-";
items[7] = "-";
items[8] = "-";
items[9] = "-";
and this the other method
public static void inv()
{
for (int i = 0; i <= 9; i ++)
{
System.out.println(items);
}
System.out.println ("");
}
the error message is
cannot find symbol
symbol: variable items
location: class keypad
System.out.println(items[i]);
cuold someone please explain to me? thanks for any replies