I have this problem accessing variables of a class from another class. I'll make a simple example to try and make myself clear.....
Code:
public class temp
{
public void temp()
{
String [] abc = new String [200];
abc[1] = "johnsmith";
abc[2] = "smithjohn";
}
}
public class accessTemp
{
public void accessTemp()
{
temp x = new temp();
System.out.println(x.abc[1]);
}
}
An error message tells me: "cannot find symbol variable abc". Why does class accessTemp cannot access variable 'abc[1]' through instance of class temp 'x'?
Thanks!