Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class project {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int[] nums1 = { 10, 20, 30 };
- int[] nums2 = { 10, 20, 30 };
- if (compareArrays(nums1, nums2)) {
- System.out.println("Equals");
- } else {
- System.out.println("Not equals");
- }
- }
- static boolean compareArrays(int[] arr1, int[] arr2) {
- if (arr1.length != arr2.length) {
- return false;
- }
- for (int i = 0; i < arr1.length; i++) {
- if (arr1[i] != arr2[i]) {
- return false;
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement