4_JAVA+Oracle面试题(有答案)(3)

2021-01-20 23:36

有用的面试题

out.println("MyRunnable: run()");
}
public void start() {
System.out.println("MyRunnable: start()");
}
}
public class MyTest {
public static void main(String args[]) {
MyThread myThread = new MyThread();
MyRunnable myRunnable = new MyRunnable();
Thread thread = new Thread(myRunnable);
myThread.start();
thread.start();
}
}
A、prints: MyThread: start() followed by MyRunnable: run()
B、prints: MyThread: run() followed by MyRunnable: start()
C、prints: MyThread: start() followed by MyRunnable: start()
D、prints: MyThread: run() followed by MyRunnable: run()
E、compile time error
F、None of the above
9、Which of the following will output -4.0?(3)
1、System.out.println(Math.floor(-4.7));
2、System.out.println(Math.round(-4.7));
3、System.out.println(Math.ceil(-4.7));
4、System.out.println(Math.min(-4.7));
10、What will happen if you attempt to compile and run the following code?(3)
Integer ten=new Integer(10);
Long nine=new Long (9);
System.out.println(ten + nine);
int i=1;
System.out.println(i + ten);
1、19 followed by 20
2、19 followed by 11
3、Error: Can’t convert java lang Integer
4、10 followed by 1
问答题
1、请写出Java中的数据类型划分及默认值。(5)
数据类型分为|:
? 基本数据类型:
|- 数值型:byte、short 、int、long,默认是0
|- 浮点型:float、double,默认是0.0
|- 字符:char,默认是“\n0000”
|- 布尔:boolean,默认是false
? 引用数据类型:默认值是null
|- 数组:
|- 类:
|- 接口:
2、Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?(5)
? OverLoad:在一个类中出现的,方法名称相同,参数的类型或个数不同,没有权限要求
? Override:在继承类中出现的,方法名称,参数的类型或个数相同,注意访问权限不能更加严格
? OverLoad只是根据参数的类型或个数来确定的,与返回值类型无关。
3、请详细解释String类的特点?StringBuffer类的特点?并列举出十个String的相关操作方法。(5)
1、String类特点:
? 一个字符串就是一个String的匿名对象
? 有两种赋值方式,一种是直接赋值,另外一种是采用关键字new完成的,第一种方式性能高,只会开辟一个堆空间,而第二种会开辟两个堆空间
? String的地址比较使用==,内容比较使用equals()
? String的内容一旦声明则不可改变,改变的是其内存地址的指向
2、StringBuffer:内容可以改变
3、方法:split()、matches()、replaceAll()、charAt()、getBytes()、subst
ring()、indexof()、toLowerCase()、toUpperCase()、startsWith()、endsWith().
4、abstract class和interface的区别?(5)
? 抽象类:包含一个抽象方法的类就是抽象类,抽象类要使用abstract关


4_JAVA+Oracle面试题(有答案)(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:彰显中医特色 打造一流医院——湖南省浏阳市中医医院简介

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: