sorry if this is a simple question but i am new to java and rather frustrated.
i have a class Hostel and a class Main. in the Hostel class i have the variable myString and i am trying to use it to occupy a textarea called output in Main when button findRoomB is clicked but i am told the variable cannot be found.
Below is the code in the Main class where the error is shown
findRoomB.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
HostelClass find = new HostelClass();
ouput.setText(myString);
}
});
error: cannot find symbol
symbol: variable myString
any help would be greatly appreciated.
You need to retrieve myString from the find instance of HostelClass:
or