编号:
时间:2021年X月X日 书山有路勤为径,学海无涯苦作舟 页码:
第1贞共34页
企业笔试面试题分析
本套题目主要出自神州数码,华为,笔试考试题以及SCJP认证考题
一,选择题
.下列数组初始化正确的是:C
Aint[5] a= {123,4,5};
BinU2n2]a={{l,2},{3,4)};
Cint(][]a={{23A5},newint[3]};
D int[][] a = new
.: B public class Student (
private String name;
public Studcnt(String ) //I
( name = s_name; //2
)
public static void main(String args[J) (
Student s = new Student(); //3
) )
使用如下指令编译: javac 将会得到什么结果? ,。 〃3处出错。
〃2处出错。 〃1处出错。
.关于下述程序:C public class Divide (
public static void main(String args[J) (
(,M, = ,M,+); //I
(H,,17/0 = "”+17/0); //2
) )
编号:
时间:2021年X月X日 书山有路勤为径,学海无涯苦作舟 页码:
第3贞共34贞
编号:
时间:2021年X月X日 书山有路勤为径,学海无涯苦作舟 页码:
描述正确的是?
,运行时〃 1、〃2处均出现异常
,运行时〃 1处得到一个无穷大值,〃2处将出现异常
,运行时〃 1处出现异常,〃2处将得到一个无穷大值
.有下而程序:B
public class TestString (
public static void main(String[] args) (
String strl = "abed";
String str2 = %bcd’‘;
String str3 = new StringC'abcd );
String str4 = new StringC'abcd );
(strl==str2);
(str3==str4); )
)
输出结果是?
A true true B true false C false true D false false
.关于下面的类描述中正确的是:C
class Test {
void test(int i) {
(MMI am an
)
void test(String s) {
(,,HI am a string.”"); )
public static void main(String args[]) {
Test t=new Test();
char ch='y';
(ch);
) )
,运行出错
,运行时输出Camanint”
,运行时输出Dam a string”
.如希望父类中的某成员变量能被任何包中的子类直接访问,那么定义该变量时使用限定 词—最适合。c
A. public B private C protected D. default
.当编译和运行下列程序段时,会发生什么? C
class Base {}
编号:
时间:2021年X月X日 书山有路勤为径,学海无涯苦作舟 页码:
第3贞共34贞
编号:
时间:2021年X月X日 书山有路勤为径,学海无涯苦作舟 页码:
class Sub extends Base {}
class Sub2 extends Base {}
public class CEx{
public static void main(String argv[]){
Base b = new Base();
Sub s = (Sub)
java面试题大全 来自淘豆网m.daumloan.com转载请标明出处.