Hello everyone,
Here is the problem that I am trying to solve: Write a method that is passed two arrays. Your method should return true if the two arrays have the same size and the same contents. Otherwise, return false.
I am receiving the following error in BlueJ - ".class expected" on this line:
System.out.println(f(int[] a, int[] b)); // print out the value returned by f
Any help would be appreciated very much.
Here is what I have completed so far:
class Num2 { public static void main (String[] args) { int[] a = {3, 4, 5, 6, 7}; int[] b = {5, 8, 9, 10, 5}; f(a, b); // call the f method System.out.println(f(int[] a, int[] b)); // print out the value returned by f } public static boolean f(int[] a, int[] b) { if (a.length == b.length) { for (int i = 0; i < a.length; i++) { if (a[i] != b[i]) return false; } return true; } else return false; } }