I am an eighth grader in need of some help with a small project I am doing in Java. I am trying to create an application that finds the solution of two linear equations (user enters two slopes and two y-intercepts (one for each equation)). The values that are returned from the "plotter" methods are stored into arrays. I have different methods for each of the "plotter" sections. I then need to be able to access both arrays in another method. But I get a "variable not found" error for both arrays when I try to "call" the method. The "code" below is just an outline of what I am working on (a rough one, at that). Please let me know if I need to include more. Thank You!
public class fooBar{
public static void main(String[] args){
fooBar.doStuff1();
fooBar.doStuff2();
fooBar.doMoreStuff(array1, array2);
}
public static void doStuff1(){
//this method defines array1 (with long values) and assigns values to it
}
public static void doStuff2(){
//this method defines array2 (with long values) and assigns values to it
}
public static void doMoreStuff (long[] array1, long[] array2){
//this method needs to have access to array1 and array2
//to do the calculations and such
}
}
[]
. We have collections, you know. Use them. – Martin Schröder Mar 31 '12 at 18:39