JAVA软件工程师笔试题(二十三)

时长:60分钟 总分:100分

239浏览 1人已完成答题

题型介绍
题型 单选题 简答题
数量 17 2
JAVA软件工程师笔试题(二十三)
1.
以下哪些关于构造器的描述是正确的?
问题详情




2.
11) 已知如下代码: 1: class Example{ 2: String str; 3: public Example(){ 4: str= "example"; 5: } 6: public Example(String s){ 7: str=s; 8: } 9:} } 10: class Demo extends Example{ 11: } 12: public class Test{ 13:public void f () { 14:Example ex = new Example("Good"); 15:Demo d = new Demo("Good"); 16:} } 哪句语句会导致错误?
问题详情




3.
下列给出的代码段运行结果是? public class Example { int maxElements; void Example() { maxElements = 100; System.out.println(maxElements); } public Example(int i) { maxElements = i; System.out.println(maxElements); } public static void main(String[] args) { Example a=new Example(); Example b=new Example(999); } }
问题详情




4.
以下哪些修饰符可以用于构造器?
问题详情




5.
当一个类的所有构造器均为私有的,以下哪个描述是正确的?
问题详情




6.
以下哪个针对默认无参构造器描述是正确的?
问题详情




7.
关于构造器说法错误的是?
问题详情




8.
以下代码的执行结果是: public class Example { String s = "Outer"; public static void main(String[] args) { S2 s2 = new S2(); s2.display(); } } class S1 { String s = "S1"; void display() { System.out.println(s); } } class S2 extends S1 { String s = "S2"; }
问题详情




9.
以下代码的执行结果是: public class Example { static int i = 1, j = 2; static { display(i); i = i + j; } static void display(int n) { System.out.println(n); } public static void main(String[] args) { display(i); } }
问题详情




10.
给出如下代码: class Test{   private int m;   public static void fun() {     // some code...   } } 如何使成员变量m 被函数fun()直接访问?
问题详情




11.
以下哪个约束符可用于定义成员常量
问题详情




12.
类(外部类)可以使用哪个访问权限修饰符?
问题详情




13.
下列说法正确的是?
问题详情




14.
以下代码执行后,x的值为 public class Example { public static void main(String[] args) { int x = 0; boolean b1, b2, b3, b4; b1 = b2 = b3 = b4 = true; x = (b1 | b2 & b3 ^ b4) ? x++ : -x; System.out.println(x); } }
问题详情




15.
下列给出代码的运行结果是? public class Example { public static void main(String[] args) { int m = 2; int p = 1; int i = 0; for (; p < 5; p++) { if (i++ > m) { m = p + i; } } System.out.println("i equals " + i); } }
问题详情




16.
给出以下代码,假设arr数组中只包含正整数值,请问下列代码段实现了什么功能? public int guessWhat(int arr[]) { int x = 0; for (int i = 0; i < arr.length; i++) { x = x < arr[i] ? arr[i] : x; } return x; }
问题详情




17.
下列代码执行结果是? public class Example { public static void main(String[] args) { String str = "123"; String str1 = new String("123"); String str2 = "123"; System.out.println(str == str1); System.out.println(str == str2); } }
问题详情




18.
简述java.awt包中5种布局管理器。
问题详情
19.
java图形用户界面中,顶层容器有哪三种,并写出类名。
问题详情