pastebin

Paste Search Dynamic
Recent pastes
arrays equals
  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. public class Main
  9. {
  10.         public static void main (string[] args) throws java.lang.exception
  11.         {
  12.                 // your code goes here
  13.                 string[] cities = new string[]{"London", "Paris", "NewYork", "HongKong", "Tokyo"};
  14.  
  15. string[] metros = new string[]{"London", "Paris", "NewYork", "HongKong", "Tokyo"};
  16.  
  17. string[] capitals = cities;
  18.  
  19. system.out.println("cities == metros : " + (cities == metros));
  20.  
  21. system.out.println("cities == capitals : " + (cities == capitals));
  22.  
  23. system.out.println("cities.equals(metros) : " + cities.equals(metros));
  24.  
  25. system.out.println("cities.equals(capitals) : " + cities.equals(capitals));
  26.  
  27. system.out.println("Arrays.equals(cities, metros) : " + arrays.equals(cities, metros));
  28.  
  29. system.out.println("Arrays.equals(cities, capitals) : " + arrays.equals(cities, capitals));
  30.  
  31.         }
  32. }
Parsed in 0.076 seconds