在Java中,以下哪个代码片段正确地使用了instanceof运算符来判断一个对象是否为Integer类型? A. if(obj instanceof Integer) { System.out.println("obj是整型"); } B. if(obj == Integer) { System.out.println("obj是整型"); } C. if(obj.equals(Integer)) { System.out.println("obj是整型"); } D. if(obj = Integer) { System.out.println("obj是整型"); } 答案解析 instanceof运算符的正确使用格式是:变量 instanceof 数据类型。因此,选项A正确地使用了instanceof运算符来判断一个对象是否为Integer类型。 正确答案:A