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. 移动端 new CustomEvent('input') 兼容问题

    最近在 安卓自带浏览器 上发现  new CustomEvent('input') 不兼容 解决办法 (function () { if(!!window.CustomEvent) return; f ...

  2. vs2010模板修改

     使用visual studio 2010好久了,也遇到了不少问题,下面跟大家分享一些. 模板修改 说明: 主要工具: 以visual studio 2010作为例子,具体目录可能会根据不同的安装目录 ...

  3. Android数据加载和Json解析——蓝本

    1.下载数据来创建一个实体类 class MyData { String imagepath; String title; String desc; public MyData(String imag ...

  4. 初识 Cloudera Impala

    Impala是Cloudera公司主导开发的新型查询系统,它提供SQL语义,能查询存储在Hadoop的HDFS和HBase中的PB级大数据.已有的Hive系统尽管也提供了SQL语义,但因为Hive底层 ...

  5. hdu2571命

    称号: Problem Description 穿过幽谷意味着离大魔王lemon已经无限接近了! 可谁能想到,yifenfei在斩杀了一些虾兵蟹将后.却再次面临命运大迷宫的考验.这是魔王lemon设下 ...

  6. (大数据工程师学习路径)第五步 MySQL参考手册中文版----MySQL数据库管理

    一.MySQL权限管理 账户权限信息被存储在mysql数据库的user.db.host.tables_priv.columns_priv和procs_priv表中. GRANT和REVOKE语句所用的 ...

  7. PAT 1033. To Fill or Not to Fill (贪婪)

    PAT-A最后一个问题.最后做出来... 贪婪,通过局部优化全局优化. 1. 该加油站按距离升序排列 2. 记录气体台当前所在index,目前的汽油.开支.在您的整个背部 3. 遍历中有两种情况: 1 ...

  8. 随笔 - Internet缓存文件

    Internet缓存文件 本文地址: http://blog.csdn.net/caroline_wendy 互联网上全部的使用记录, 图片, 音乐, 视频, 都会缓存在本地. 1. 位置: IE-& ...

  9. C#管理控制IIS7的方法

    原文:C#管理控制IIS7的方法 转自 http://www.lob.cn/jq/csyy/7285.shtml 把在找到正确方法前遇到的挫折也拿出来与大家分享,相信不少朋友从iis6到iis7的过渡 ...

  10. 正则获取URL参数

    一 获取指定URL参数 function getUrlParams(name) { var reg = new RegExp("(^|&)" + name + " ...