Compare two char type arrays in Java
Description
The following code shows how to compare two char type arrays.
Example
/*from w ww . j av a 2 s . co m*/
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
boolean b = Arrays.equals(new char[] { 'a' }, new char[] { 'a' }); // true
System.out.println(b);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »