fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. double vetor1[] = new double[3];
  13. double vetor2[] = new double[3];
  14. vetor1[0] = 1;
  15. vetor1[1] = 2;
  16. vetor1[2] = 3;
  17.  
  18. vetor2[0] = 1;
  19. vetor2[1] = 2;
  20. vetor2[2] = 3;
  21.  
  22.  
  23. if(Arrays.equals(vetor1,vetor2)){
  24. System.out.println("vetor1 e vetor2 iguais");
  25. }else{
  26. System.out.print("vetor1 e vetor2 diferentes");
  27. }
  28.  
  29. vetor1[0] = 1;
  30. vetor1[1] = 2;
  31. vetor1[2] = 5;
  32.  
  33. vetor2[0] = 1;
  34. vetor2[1] = 2;
  35. vetor2[2] = 3;
  36.  
  37. if(Arrays.equals(vetor1,vetor2)){
  38. System.out.println("vetor1 e vetor2 iguais");
  39. }else{
  40. System.out.println("vetor1 e vetor2 diferentes");
  41. }
  42. }
  43. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
vetor1  e vetor2 iguais
vetor1  e vetor2 diferentes