Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Hello everyone!, i have some problems and i would love to find a solution, see i am having a rough time trying to do this.
i have a class like this:
public class Report
{
int current;
public Report()
{
current=1;
memo[] test=new memo[10];
memo[current]=new memo();
}
public void addMemo()
{
<strong><em>//This is the objective, i simply cant figure out how to create method correctly </em></strong>
}
}
/*So far so good this actually goes through when compiling, the problem comes when i try to call Report from another class, more specifically, from inside a main class.
public class manager
{
Report a; //throws me error of can not find symbol class Report
public static void main(String[] args)
{
a=new Report();//Am i not calling to create an object of class Report?
}
}I try to run this but always throws me error lines stating:
Can not find symbol class Report
and non-static variable a can not be referenced from static context
Then the really great question is, if i know the Report class exists, how to invoke it from the main method of another class?
I know my other classes work, because i hard coded them and they work, but i need a method to increase the array by one and such method needs to be called from main, but being in a different class, like i wrote previously, always throws me the errors described.
What am i doing wrong? Thank you for any help!