博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
面试:java笔试题(1)
阅读量:4156 次
发布时间:2019-05-25

本文共 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/

你可能感兴趣的文章
android系统提供的常用命令行工具
查看>>
【Python基础1】变量和字符串定义
查看>>
【Python基础2】python字符串方法及格式设置
查看>>
【Python】random生成随机数
查看>>
【Python基础3】数字类型与常用运算
查看>>
【Python基础4】for循环、while循环与if分支
查看>>
【Python基础6】格式化字符串
查看>>
【Python基础7】字典
查看>>
【Python基础8】函数参数
查看>>
【Python基础9】浅谈深浅拷贝及变量赋值
查看>>
Jenkins定制一个具有筛选功能的列表视图
查看>>
【Python基础10】探索模块
查看>>
【Python】将txt文件转换为html
查看>>
[Linux]Shell脚本实现按照模块信息拆分文件内容
查看>>
idea添加gradle模块报错The project is already registered
查看>>
在C++中如何实现模板函数的外部调用
查看>>
在C++中,关键字explicit有什么作用
查看>>
C++中异常的处理方法以及使用了哪些关键字
查看>>
内存分配的形式有哪些? C++
查看>>
什么是内存泄露,如何避免内存泄露 C++
查看>>