Look at the call to the
res
method in
main
:
public static void main(String [] args) {
int[] arr= {3,5,2,6,4};
PairSumR.res();
Now look at the call from
res
to
isValidPair
public static void res() {
System.setOut(isValidPair(arr, 5, 3, 2));
}
But
arr
does not exist anywhere in
res
so the compiler rejects the code. You need to rework the definition of
res
and the call to it in
main
:
public static void res(int[] arr) {
System.setOut(isValidPair(arr, 5, 3, 2));
}
public static void main(String [] args) {
int[] arr= {3,5,2,6,4};
PairSumR.res(arr);
Also, I am not sure why you are using
System.setOut
here, as it expects a valid stream reference not a boolean.