joseleonweb

Untitled

Nov 23rd, 2021
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. boolean areEquals = true;
  2.        
  3. int[] a = {1,2,3,4,5};
  4. int[] b = {1,2,3,4,5};
  5.        
  6. for(int i = 0; i < a.length; i++) {
  7.     if(a[i] != b[i]) areEquals = false;  
  8. }
  9.        
  10. if (areEquals) System.out.println("Els arrays son iguals");
  11. else System.out.println("Els arrays no son iguals");
  12.  
  13. System.out.print("Array A: ");
  14. for(int element : a) System.out.print(element + " ");
  15. System.out.print("\nArray B: ");
  16. for(int element : b) System.out.print(element + " ");
Advertisement
Add Comment
Please, Sign In to add comment