精度问题:double n1 = 3.0*0.1; double n2 = 3.0; float n3 = 3.0f; // System.out.println ("n1:" + n1);//0.3000000...0004 System.out.println ("n2:" + n2);//3.0 System.out.println ("n3:" + n3);//3.0 // System.out.println (n1 == n2);//false System.out.println (n1 == n3);//false System.out.println (n2 == n3);//true |