zoukankan      html  css  js  c++  java
  • JAVASE 打印输出--------01

    public class Demo01 {
        public String a1;
        public int a2;
    
        public Demo01(String a, int i) {
            a1 = a;
            a2 = i;
        }
    
        public void dispose() {
            a1 = null;
        }
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Demo01 a = new Demo01("test", 3);
            Demo01 a3 = new Demo01("test", 3);
            if (a == a3) {
                System.out.println("(a == a3)..." + "true");
            } else {
                System.out.println("(a == a3)..." + "false");
            }
    
            Demo01 a2 = a;
    
            if (a == a2) {
                System.out.println("(a == a2)..." + "true");
            } else {
                System.out.println("(a == a2)..." + "false");
            }
            a.dispose();
            if (a == a2) {
                System.out.println("(a == a2)..." + "true");
            } else {
                System.out.println("(a == a2)..." + "false");
            }
            a3.a1 = "test";
            if (a2 == a3) {
                System.out.println("(a2 == a3)..." + "true");
            } else {
                System.out.println("(a2 == a3)..." + "false");
            }
    
            System.out.println("*****************************************");
            System.out.println("equal?" + a.a1 == a2.a1);
        }
    
    //  以下是输出结果:
    //    (a == a3)...false
    //    (a == a2)...true
    //    (a == a2)...true
    //    (a2 == a3)...false
    //    *****************************************
    //    false
    }
  • 相关阅读:
    企业生产环境不同业务linux系统分区方案
    linux 文件 s 权限
    shell中的命令与特殊符号
    Linux数组基础
    shell脚本学习(1)
    文件的压缩与打包
    Linux 磁盘管理基础命令df,du,fdisk,mke2fs
    mkpasswd的使用
    P1080 国王游戏
    P1315 观光公交
  • 原文地址:https://www.cnblogs.com/androidsj/p/5575820.html
Copyright © 2011-2022 走看看