笔试题

package com.cust_pro;

import javax.management.RuntimeErrorException;

public class TestValuedasd {
{
System.out.println("test1");

}
static
{
System.out.println("test2");
}
public TestValuedasd()
{
System.out.println("test3");
}
public static void main(String[] args) {
Integer i=100;
Integer ii=100;//设计模式--享元模式 共享内存地址
// Integer iii=null;
// int k=iii; 空指针异常

if(i==ii)//指向的内存地址相同
{
//当
System.out.println("相等");
}else
{
System.out.println("不相等");
}
new TestValuedasd();
new TestValuedasd();
try
{
throw new RuntimeException();
}
finally
{
return ;
}
//什么都没有输出 因为异常跑出去并没有被捕捉

}

}

原文地址:https://www.cnblogs.com/hds-study-blogs/p/6689698.html