为什么不用equals而要用==呢?

解决方案 »

  1.   


    when u compare two objects, the symbol "==" is used to compare the two points of the objects, not objects. if the objects are basic object type of date, such as "String","Integer", u can use "equals" to compare the objects directly. but if not, u should implement the interface Comparable and the method compareTo() before using "equals".
    "12341" is a String object.
    i don't know what is the type of "cnl.item(j).getNodeValue()". check it.
      

  2.   

    ==       for low level compare----->compare reference
    equals() for deep level compare---->compare object that refferene-->it's content
      

  3.   

    if(cnl.item(j).getNodeValue().equals("12341"))
      

  4.   

    if(cnl.item(j).getNodeValue().equals("12341"))
      

  5.   

    cnl.item(j).getParentNode().toString()有问题吧?
    换成“aaaaaaaaaaaaa"试试