2020年JAVA程序员笔试面试题库300题[含答案]
一、简答题
1."给出下面的不完整的方法:
1)
2){ success = connect() ;
3)if (success == -1){
4) throw new TimeOutException();
5)}
6)}
TimeOutException 不是一个RuntimeException,下面那行可以放在 1)处?
A. public void method() throws Exception
B. public void method()
C. public void method() throws TimeOutException
D. public void method() throw TimeOutException
答案:
2.合法标识符的定义"? 1. 只能以字母,下划线(_)或美元符($)开头,数字不能作为开头
? 2. 不能包含美元符($)以外的特殊符号
? 3. 不能包含空格
? 4. 可以是中文字符或日文字符
答案:1
3."下面代码显示的结果是什么
public class Test {
static init arr[] = new int[0]
public static void main(String [] arge) {
System.out.print(arr[1]);
}
}
答案:可编译通过,运行报异常
4.String s1=”Hello”表达式s1==”Hello”返回true or false
答案:TRUE
5.将两个表连接在一起时,下面那一项通常是另外一个表的主键A. 外键
B. 总控键
C. 重复的组