Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. package ejemplos2;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class ejercicio6 {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. ArrayList<String> lista1 = new ArrayList<>();
  10. lista1.add("hola");
  11. lista1.add("chao");
  12.  
  13. ArrayList<String> lista2 = new ArrayList<>();
  14. lista2.add("hola");
  15. lista2.add("chao");
  16.  
  17. System.out.println(comparar(lista1, lista2));
  18. }
  19.  
  20. public static boolean comparar(
  21. ArrayList<String> lista1, ArrayList<String> lista2) {
  22.  
  23. boolean retorno = true;
  24.  
  25. if (lista1.equals(lista2))
  26. {
  27. retorno = true;
  28. }else{
  29. retorno = false;
  30. }
  31.  
  32.  
  33. return retorno;
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement