本文共 1479 字,大约阅读时间需要 4 分钟。
由于当时忘了拍个照,所以面完后只记得几题了,还有些不记得,因为内容太多不好记,所以就把印象深刻或者有疑问的记下。
以后面试的笔试题都记录在这。
接口和抽象类的区别
答:抽象类继承于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(); }}
答:编译异常
将下列数字排序1、3、8、2、4、9、19;
答
int[] arrayInt = {1、3、8、2、4、9、1}; for (int i = 0; i <= arrayInt.length - 1; i++) { for (int j = 0; j < arrayInt.length - 1; j++) { if (arrayInt[j] > arrayInt[j + 1]) { int team = arrayInt[j]; arrayInt[j] = arrayInt[j + 1]; arrayInt[j + 1] = team; } } } for (int arr : arrayInt) { System.out.print(arr + " "); }
实现将整数转化为中文表示的金额,例如¥1011 = 壹仟零壹拾壹元整;
答
转载地址:http://shwxi.baihongyu.com/