Vector vt = gathering.loadRePay(clientId,salerid,currencytype);
vt = vt==null?new Vector():vt;
BigDecimal gaMoney = new BigDecimal(money);
BigDecimal beMoney = new BigDecimal(money);
  求这一段代码解释!!java

解决方案 »

  1.   

    如果vt为空的话则new 一个Vector。vt指向这个new出来的对象,如果不为空的话则vt = vt,其实这个还是不用三目运算的好,只要一个if语句不要else
      

  2.   

    vt = vt==null?new Vector():vt;
    等价于
    if(vt == null)
      vt = new Vector();
      

  3.   


    Vector vt = gathering.loadRePay(clientId,salerid,currencytype);
    if(vt==null){
        vt = new Vector();
    }
    BigDecimal gaMoney = new BigDecimal(money);
    BigDecimal beMoney = new BigDecimal(money);
      

  4.   

    vt = vt==null?new Vector():vt;
    --------------------------------------------------
    if(vt==null){
        vt = new Vector();
    }
      

  5.   

    其实这是有错误的 人家是三目运算 你把else去掉了
    应该改if(vt == null)
    {
    vt = new Vector();
    }else
    {
    vt  = vt
    }