Java is saying there is an error on the code below and I cant find it. I have indicated the 2 problem lines with a comments right above the lines reading "Problem line" and I have indicated the method closely related to this problem lines with a "Closely related" comment right above it. The error reads that "it cant resolve the symbol processed" and I dont why the heck not since I have in fact defined the variable (where I have marked problem line 1) . It really stomped me when I noticed that it gives a warning that the "variable processed is never used" in the spot where I defines it, even as it tells me that it dont know where it came from at the place where I try to use it. p.s., I do have a Scanner imported, i just that stackoverflow cut that part when they were uploading the code.
public class sub {
String NameNum;
int FirstNum, SecondNum, ThirdNum;
public sub(){
Scanner input = new Scanner(System.in);
System.out.println("Enter List Name");
NameNum = input.next();
System.out.println("Enter number");
FirstNum = input.nextInt();
System.out.println("Enter number");
SecondNum = input.nextInt();
System.out.println("Enter number");
ThirdNum = input.nextInt();
// Problem Line 1 of 2 below
int[] processed = process(FirstNum, SecondNum, ThirdNum);
}
public void print(){
System.out.println(NameNum + ": " + FirstNum + " " + SecondNum + " "
+ ThirdNum);
}
//Closely related to Problem lines (method below, 3 lines in all)
int[] process(int FirstNum, int SecondNum, int ThirdNum) {
int [] processed = {FirstNum, SecondNum * 2, ThirdNum * 3};
return processed;
}
public void printProcessed(){
//Problem line 2 of 2 below
System.out.println(NameNum + " Processed: " + processed[0] +
processed[1] + processed[2]);
}
}