body
{
font-family: 微软雅黑;
font-size: 14px;
line-height: 2;
}
html, body
{
color: inherit;
background-color: inherit;
}
h1 {
font-size:1.5em;
font-weight:bold;
}
h2 {
font-size:1.4em;
font-weight:bold;
}
h3 {
font-size:1.3em;
font-weight:bold;
}
h4 {
font-size:1.2em;
font-weight:bold;
}
h5 {
font-size:1.1em;
font-weight:bold;
}
h6 {
font-size:1.0em;
font-weight:bold;
}
img {
border:0;
max-width: 100%;
}
blockquote {
margin-top:0px;
margin-bottom:0px;
}

自己最近在面试的时候,遇到两个面试题记忆比较深刻,这里记下来分享给大家.
 
1. 
如下给出了两个Java类
父类(Parent)
public class Parent {
    static{
        System.out.println("Parent_1");
    }
 
    {
        System.out.println("Parent_2");
    }
 
    public Parent(){
        System.out.println("Parent_3");
    }
}
 
子类 (Child)
public class Child extends Parent {
    static{
        System.out.println("Child_1");
    }
    
    {
        System.out.println("Child_2");
    }
    
    public Child(){
        super();
        System.out.println("Child_3");
    }
    
    public static void main(String args[]){
        new Child();
    }
}
请写出正确的打印顺序.
 
 
2.
给出如下的Java代码(这道题很有意思哟!)
public class Test {
    public static void main(String[] args){
        Integer m1 = 25;
        Integer m2 = 25;
        Integer n1 = new Integer(25);
        Integer n2 = new Integer(25);        
        Integer x1 = 127;
        Integer x2 = 127;
        Integer y1 = 128;

        Integer y2 = 128;
 
        System.out.println(m1==m2);
        System.out.println(n1==n2);
        System.out.println(x1==x2);
        System.out.println(y1==y2);
    }

}

请写出最后的输出结果.

最新文章

  1. 说一说python的牛比与不爽
  2. 堆栈指针 ---delete 使用
  3. Delphi 之前解析串口数据
  4. 关于登录的会话控制, 终极解决方案 - chunyu
  5. P147、面试题26:复杂链表的复制
  6. 九度OJ 题目1384:二维数组中的查找
  7. tortoiseGit保存用户名和密码
  8. Python爬虫第二天
  9. DSAPI多功能组件编程应用-反射相关
  10. easyui combobox 设置滚动条
  11. TCP/IP 和 HTTP 的区别和联系是什么?
  12. C# 防止窗体闪烁
  13. 剑指OFFER例题——从尾到头打印链表
  14. SQL调用C# dll(第一中DLL,没使用强名称密匙,默认是 safe)
  15. as3.0控制声音大小
  16. [iOS]Xcode处理过时方法的警告
  17. es6 Promise 事件机制分析
  18. 代码记录——phase16,block36(修正后)
  19. Java读取文件方法大全
  20. Python基础 - Ubuntu+Nginx+uwsgi+supervisor部署Flask应用

热门文章

  1. PostgreSQL(Linux)安装、启动、停止、重启
  2. SPOJ 1182 Sorted bit sequence
  3. viewDidLoad方法的调用顺序
  4. linux中nginx重定向方法总结
  5. poj 2312 Battle City(优先队列+bfs)
  6. Linux rar乱码
  7. Codeforces 940F Machine Learning 带修改莫队
  8. linux中链表的使用【转】
  9. js 触发LinkButton点击事件,执行后台方法
  10. 键盘焦点和逻辑焦点(Logic Focus与Keyboard Focus )