instanceof operator in java for comparing different classes

前端 未结 4 1320
刺人心
刺人心 2020-12-11 02:57

I was trying to see how instanceof operator in Java works and am facing a very odd issue.

public static void main(String[] args) {
    Map m = new HashMap();         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-11 03:27

    Please refer to JLS spec mentioned over here http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.20.2.

    This has been answered very well here instanceof - incompatible conditional operand types

提交回复
热议问题