Java Examples - Compare arrays?

Tutorials realized by 9XR users or HK Staff.

Java Examples - Compare arrays?

Postby packermover » 23 May 2014, 19:52

import java.util.Arrays;

public class Main {
public static void main(String[] args) throws Exception {
int[] ary = {1,2,3,4,5,6};
int[] ary1 = {1,2,3,4,5,6};
int[] ary2 = {1,2,3,4};
System.out.println("Is array 1 equal to array 2?? "
+Arrays.equals(ary, ary1));
System.out.println("Is array 1 equal to array 3?? "
+Arrays.equals(ary, ary2));
}
}

packers and movers in Chennai
packermover
 
Posts: 9
Joined: 21 May 2014, 20:01

Re: Java Examples - Compare arrays?

Postby packermover » 26 May 2014, 14:48

Thank you for this Posting...

packers and movers in Chennai
packermover
 
Posts: 9
Joined: 21 May 2014, 20:01


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron