精选最新2020年JAVASE综合完整考试题库188题(含答案)

更新时间:2023-06-28 03:07:47 阅读: 评论:0

新概念英语第一册全集
2020年JAVASE综合考试试题库188题[含答案]
一、选择题
1.表示键值对概念的接口是哪项?
答案:D
A.Set
B.List
C.Collection
D.Map戕害
2."现有如下代码:
public class Example {
kiss you
public static void main(String[] args) {
  try {
  System.out.println(""before"");
  doRisyThing();
  System.out.println(""after"");
  } catch (Exception e) {
  System.out.println(""catch"");
  }
  System.out.println(""done"");
}
public static void doRisyThing() throws Exception{
  //this code returns unless it throws an Exception
}
}
该代码可能的执行结果有哪些?"christmas song
答案:
A.before catch
B.before after done
C.before catch done
D.before after catch
3."下列代码的执行结果是?
class Example {
private void method1() throws Exception {
  throw new RuntimeException();
}
public void method2() {
  try {
  method1();
  } catch (RuntimeException e) {
  System.out.println(""Caught Runtime Exception"");
  } catch (Exception e) {
as long as you love me mp3  System.out.println(""Caught Exception"");
  }
}
public static void main(String[] args) throws IOException {
  Example a = new Example();
  a.method2();
}
}"
答案:
A.代码编译失败
B.输出Caught Runtime Exception
C.输出Caught Exception
D.输出Caught Runtime Exception和Caught Exception
4.Java语言中异常的分类是哪项?
答案:
A.运行时异常和异常
B.受检异常和非受检异常
成都插花学校
C.错误和异常
D.错误和运行时异常
5.下列关于Math类说法错误的是
答案:
A.java.lang.Math类是final类,因此不能被其他类继承
B.java.lang.Math类的构造器是私有的,即声明为private,不能实例化一个Math类的对象
C.java.lang.Math类上定义的所有常量和方法均是public和static的,因此可以直接通过类名调用
D.min()和max()方法的参数之一,如果是NaN值,则方法将返回另一个参数值
6."以下代码的输出结果是什么?
public class Example {
public static void main(String[] args) {
  System.out.und(Float.MAX_VALUE));
}
alternatives
}"
答案:B
A.输出Integer.MAX_VALUE
B.输出一个最接近Float.MAX_VALUE的整数
C.编译失败
D.运行时输出异常信息
7."以下代码的运行结果是什么?
public class Example {
public static void main(String[] args) {
  System.out.println(Math.min(0.0, -0.0));
}
}"
答案:C
yanwu
A.代码编译失败
B.输出0.0
C.输出-0.0
D.代码编译成功,但运行时输出异常信息
8."给出以下代码,请问在程序的第6行插入那条语句,改程序可依次打印输出11、10、9?
1.public class Example {
2. public static void main(String[] args) {
3.  double x[] = { 10.2, 9.1, 8.7 };
4.  int i[] = new int[3];
5.  for (int a = 0; a < x.length; a++) {
6.
7.  System.out.println(i[a]);
8.  }
9. }
10.}"
etiquette答案:C
A.i[1] = ((int)Math.min(x[a]));
B.i[1] = ((int)Math.max(x[a]));
C.i[1] = ((il(x[a]));
D.i[1] = ((int)Math.floor(x[a]));
9.下列哪些项是泛型的优点?
答案:A
A.不用向下强制类型转换
B.代码容易编写
C.类型安全
D.运行速度快
10.以下哪些是Collection接口的子接口?
答案:BD
A.Dictionary
B.List
C.Map
D.Set
11."现有:
String s = ""write a line to a file"";
w.print(s + ""\n"");
mmk哪一个是对的?"
答案:
A.w既可以是PrintWriter类型,也可以是BufferedWriter类型
B.w既不可以是PrintWriter类型,也不可以是BufferedWriter类型
C.w可以是PrintWriter类型,但不可以是BufferedWriter类型
D.w既可以是BufferedWriter类型,也可以是PrintWriter类型
12.以下哪些集合接口支持重复元素存在?

本文发布于:2023-06-28 03:07:47,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/160040.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:代码   接口   不能   运行   结果   方法   输出   试题库
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图