java hashCode测试

import java.math.BigDecimal;
import java.time.format.DecimalStyle;
import java.util.HashMap;

public class HashTest {
    public static void main(String[]    args)
    {
        System.out.println("1".hashCode());
        String a="12";
        System.out.println(a.hashCode());
        Integer b=12;
        System.out.println(b.hashCode());
        Long c= b+1L;
        System.out.println(c.hashCode());
        Double d= 112d;
        System.out.println(d.hashCode());
        BigDecimal e= new BigDecimal(123);
        System.out.println(e.hashCode());


        char m=40;
        int n = m;
        System.out.println(n);

        //char 和int 可以直接赋值 但是要注意 是根据asc码来赋值的 如果int转char的时候 如果数字40要转化为字符的话 不能直接强转 否则会按照asc码转化为'('
    }
}

 

posted @ 2019-09-12 14:51  wygflying  阅读(125)  评论(0编辑  收藏  举报