package cn.edu.shu.web.test;

public class TestInteger {
public static void main(String[] args) { /**
* 很奇怪的问题,问题来源是在Struts2的action中,假设从session中取值,假设取不到的话,那么应该为null,因为我将其强转为Integer类型了,其后再将其与Integer比較时,竟然抛空指针异常
*/
Object one = null;
Integer two = (Integer) one;
System.out.println(null == two);// out put true
System.out.println(two instanceof Integer);// out put false
System.out.println(two instanceof Object);// out put false
// System.out.println(0 == two);// 抛出空指针异常 // 思索,因为JDK有自己主动拆装箱操作,所以即使用的是Integer,其也会被拆箱为int类型,这样在使用==操作符时,不满足int型和null型比較 // 编译错误: The operator == is undefined for the argument type(s) int, null
System.out.println(0 == null); }
}

The operator == is undefined for the argument type(s) int, null的更多相关文章

  1. java 短路与(||)时报错The operator || is undefined for the argument type(s) int, boolean

    今天在使用短路与时,报错The operator || is undefined for the argument type(s) int, boolean 代码如下: 最后发现是少了一个=,比较要使 ...

  2. 项目重新部署后报The attribute required is undefined for the annotation type XmlElementRef

    在另外一台机器上部署项目,项目导进Eclipse中发现有异常 public class BooleanFeatureType extends FeatureBaseType{ @XmlElementR ...

  3. Caused by: java.lang.IllegalArgumentException: argument type mismatch

    下面是我的报错信息 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java: ...

  4. @RequestParam注解使用:Name for argument type [java.lang.String] not available, and parameter name information not found in class file either.

    详细错误信息 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Re ...

  5. struts上传文件报argument type mismatch错误

    报错如下图所示: 报错原因:把String 强行转换成FormFile,所以才会抛出argument type mismatch.经查询:表单(html:form)中enctype="mul ...

  6. The attribute required is undefined for the annotation type XmlElementRef

    异常描述: 几天没用的项目导进Eclipse中发现有异常 public class BooleanFeatureType extends FeatureBaseType{ @XmlElementRef ...

  7. Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复

    网上很多写法都是 type='fanout' 这样的.(这里是基于python=3.6版本, pika=0.13.0 版本) credentials = pika.PlainCredentials(' ...

  8. 关于spring java.lang.IllegalArgumentException: Name for argument type [java.lang.String] 的错误

    况描述: web工程在windows环境eclipse下编译部署没有问题,系统升级时需要运维从Git取相应的源码并编译部署到线上机器,部署启动正常没有错误,当访问业务的action时报错,如下. 错误 ...

  9. 【Problems】Could not set property 'id' of 'xxx' with value '' Cause argument type mismatch

    一个问题:向comment表添加记录时,报错, 无法设置值. reflection.ReflectionException: Could not set property 'id' of 'class ...

随机推荐

  1. 具体说明 Flume介绍、安装和配置

    社论: 本文总结"Hadoop生态系统"中的当中一员--Apache Flume 写在前面二: 所用软件说明: 一.什么是Apache Flume 官网:Flume is a di ...

  2. GitBook 配置说明

    1. 下载并安装 npm node-v0.12.0.pkg http://nodejs.org/download/ 2. 安装 gitbook $ sudo npm install gitbook-c ...

  3. JavaScript权威指南科13章 webj浏览器avascript

    13.1 clientjavascript window对象是所有clientjavascript特点和api主要的接入点.它代表了一个浏览器窗口,通过window对象引用它. window 方法 a ...

  4. Eclipse-----jrebel实现jetty热部署

    步骤1:下载jrebel将文件解压缩到任意文件夹 步骤2:配置jetty watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGVrZXdhbmd6aQ==/f ...

  5. CORS

    CORS(跨域资源共享) 前言:上一篇文章提到使用JSONP实现跨域请求的时候,偶然间提到CORS,即Cross-Origin Resource Sharing(跨域资源共享).虽然前些天也看了一下, ...

  6. 安装、设置与启动MySql绿色版的方法

    原文:安装.设置与启动MySql绿色版的方法 1.解压 mysql-noinstall-5.1.30-win32.zip(下载地址http://dev.mysql.com/downloads/mysq ...

  7. ash

    查看当前用户使用的Shell,echo $SHELL BusyBox ('01-current) The BusyBox distribution is aiming for small implem ...

  8. requirejs实现模块化

    使用requirejs实现模块化编程 > 序言 - -# 公司大了,业务多了,前端代码量也逐渐增大,我们渐渐的依赖js实现的交互越来越多,长期以来会导致我们的代码维护越来越困难,所以依赖的插件也 ...

  9. 银联+移动+三星PK微信、余额宝

    在不远的将来,你可以扔掉钱包,扔掉信用卡,揣着手机买东西. 银联.移动.三星这些不同的行业大佬,因为这个目标,被一款名叫NFC的支付技术连接在了一起. 这场游戏的参与者众多,一个合纵连横的时代正在到来 ...

  10. NSOJ Minimum Transport Cost

    These are N cities in Spring country. Between each pair of cities there may be one transportation tr ...