import static java.lang.System.*;
public class IntegerTestOne{
public static void main(String []args){
Integer in1=new Integer(6);
Integer in2=new Integer(6); Integer in3=6;
Integer in4=6;
//Integer in4=Integer.valueOf(6);
//也可以采用valueOf()方法来创建Integer对象,同样也会缓存该方法创建的对象 int in5=6;
int in6=6; Integer in7=222;
Integer in8=222; out.println(in1==in2);//Integer类使用new方法生成的不是同一个对象
out.println(in3==in4);//原则上不能直接赋值给一个Integer对象,但JDK 1.5后自动将基本数据类型转化为对应的封装类型
out.println(in5==in6);//in6的地址指向in5
out.println(in7==in8);// Integer只缓存-128~127之间的Integer对象 }
}
false
true
true
false

http://www.cnblogs.com/shenliang123/archive/2012/04/16/2451996.html

Integer的更多相关文章

  1. LeetCode 7. Reverse Integer

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you ...

  2. Integer.parseInt 引发的血案

    Integer.parseInt 处理一个空字符串, 结果出错了, 程序没有注意到,搞了很久, 引发了血案啊!! 最后,终于 观察到了, 最后的部分: Caused by: java.lang.NoC ...

  3. 由一个多线程共享Integer类变量问题引起的。。。

    最近看到一个多线程面试题,有三个线程分别打印A.B.C,请用多线程编程实现,在屏幕上循环打印10次ABCABC- 看到这个题目,首先想到的是解决方法是定义一个Integer类对象,初始化为0,由3个线 ...

  4. [LeetCode] Integer Replacement 整数替换

    Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If ...

  5. [LeetCode] Integer Break 整数拆分

    Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...

  6. [LeetCode] Integer to English Words 整数转为英文单词

    Convert a non-negative integer to its english words representation. Given input is guaranteed to be ...

  7. [LeetCode] Roman to Integer 罗马数字转化成整数

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  8. [LeetCode] Integer to Roman 整数转化成罗马数字

    Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...

  9. [LeetCode] String to Integer (atoi) 字符串转为整数

    Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. ...

  10. [LeetCode] Reverse Integer 翻转整数

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...

随机推荐

  1. Flink -- Barrier

    CheckpointBarrierHandler 这个接口用于react从input channel过来的checkpoint barrier,这里可以通过不同的实现来,决定是简单的track bar ...

  2. CSS水平居中

    三种情况:1.行内元素(文本.图片等) 给父元素设置text-align:center;来实现 2.定宽块状元素 <style> div{ border:1px solid blue; w ...

  3. LUA表克隆方法归纳

    lua表克隆 将lua一个表, 克隆出一份为一个独立的另外一个表. 对于一个module, 如果在require之后,获得的表对象, 不能直接修改, 例如lua缓存此表, 但是多次逻辑执行, 都使用的 ...

  4. RAC转换为RAC One Node

    1.查看数据库状态 [oracle@rone1 ~]$ srvctl config database -d rone Database unique name: rone Database name: ...

  5. Consolidated Seed Table Upgrade Patch(Patch 17204589)

    $ adop phase=apply patches= hotpatch=yes abandon=no Enter the APPS password: Enter the SYSTEM passwo ...

  6. 感冒了~ vs中py和vb实现一个小算法

    1+1*2+1*2*3+--+1*2*3*n 下面是窗体,就一个按钮和编辑框. 中途还遇到了编码问题,但是感冒太难受,加上明天还要上课.就睡了~ 晚安世界.

  7. C# App.config文件配置数据的读写

    添加程序集引用  System.configuration.dll 和命名空间 using System.Configuration; 读: ConfigurationManager.AppSetti ...

  8. Android -- 仿ios上下反弹效果

    1,前几天在一个app上看到了滑动反弹效果,觉得这个效果挺不错的,然后想自己来实现一下,在网上查了一下基本上都是大致的说了下思路,自己看了一下,决定把实现的思路来详细的写下来,先看一下我们实现的效果吧 ...

  9. [ubuntu]给ubuntu server安装xubuntu(xfce)窗口管理器

    1.安装基本图形 $ sudo apt-get install x-window-system-core 2.安装窗口管理器 $ sudo apt-get install xubuntu-deskto ...

  10. 十八、Java基础--------IO流体系以及字符流

    在上一章节中详细介绍集合框架的相关知识,在接下来的几篇文章中将讲述Java中另一个及其重要的知识——IO流,本文主要是讲述IO流的一些基本概念以及字符流的相关应用. IO流 介绍IO流之前先介绍一下什 ...