生活不易、且行且珍惜。网站首页 程序人生
面试:java笔试题(1)
发布时间:2019-03-27 21:51编辑:zj 阅读:文章分类:
Java互动QQ群:170915747
由于当时忘了拍个照,所以面完后只记得几题了,还有些不记得,因为内容太多不好记,所以就把印象深刻或者有疑问的记下。
以后面试的笔试题都记录在这。
接口和抽象类的区别
答:抽象类继承于object接口不继承;抽象类有构造器接口没有;抽象类中可以有抽象方法,也可以有普通方法,接口中只能有抽象的方法而且修饰符只能是public abstract不写默认;抽象类中可以有普通变量和常量,接口中只能有常量,而且只能是public static final不写默认;抽象类中可以有final的方法,接口中不能有final的方法;抽象类只能是单继承,多实现,接口是可以多继承其他接口,但是不能实现接口和不能继承其他类;抽象类中可以有静态的方法,接口中不可以。
78+78=132成立,结果是几进制表示的
答:11进制
以下代码的输出结果
String m = "12"; String s = new String("12"); System.out.println(m==s); System.out.println(m.equals(s));
答:false true
以下代码的输出结果
public class Null { static String str = new String("1233"); static char[] cha = {'a','b','c'}; public static void main(String[] args) { Null.test("hello",'m'); System.out.println(Null.str+" and "+Null.cha); } public static void test(String a, char b) { str = a; cha[0] = b; } }
答:hello and [C@7852e922
以下代码的输出结果:
public class Null { public static void test() { System.out.println("123"); } public static void main(String[] args) { (Null(null)).test(); } }
答:编译异常
#去评论一下
标签:#面试
版权声明:本博客的所有原创内容皆为作品作者所有
转载请注明:来自ZJBLOG 链接:www.zjhuiwan.cn


「万物皆有时,比如你我相遇」
感谢大佬打赏【请选择支付宝或微信,再选择金额】
使用微信扫描二维码完成支付
