A question about char and String?

I find out a quesiton, only record it, when i have time, i will study it.

package com.patsnap;

import java.util.Arrays;
import java.util.List;

public class TestListChar {
	public static void main(String[] args) {
		char[] arr = {',','-','-','?'};
		List<char[]> list = Arrays.asList(arr);
		char c = '?';
		if (list.contains(c)) {
			System.out.println("char");
		}
		
		String[] arrStrings = {"-",",","?"};
		List<String> list2 =  Arrays.asList(arrStrings);
		String s = "?";
		if (list2.contains(s)) {
			System.out.println("string");
		}
	}
}


The output is : string.
The question is: why list.contains(c) is false?

你可能感兴趣的:(java,String,char)