Ugly feature in Java5.0: int and Integer

陆续把我的Blog从cublog搬过来,那边没人讨论Java、JEE、Ruby等领域:)

Why more and more people prefer Ruby to Java? Because Sun is killing Java step by step..., I think, Java5.0 is the start...

Look the Ugly new feature in Java5.0 below,

import junit.framework.TestCase;

public class IntegerIntTest extends TestCase {

    public void testIntegerIntEq() {
        int i = 1;
        Integer intObj = i;
        assertTrue(intObj == i);
    }
   
    public void testIntegerIntNotEq() {
        int i = 1;
        Integer intObj = new Integer(i);
        assertTrue(i == intObj);
    }
   
    public void testIntegerObj() {
        int i = 1;
        Integer intObj1 = new Integer(i);
        assertTrue(intObj1 == i);
        Integer intObj2 = new Integer(i);
        assertTrue(intObj2 == i);
        //????!
        assertTrue(intObj2 == intObj1);
    } 
   
}

This feature breaks the transition law: If A==B and B==C, then A==C.

Sun's guys are making Java ugly and dirty... Maybe it's the time to enjoy the beauty of Ruby:(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值