1 / 90
文档名称:

javaSE面试题.pdf

格式:pdf   页数:90页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

javaSE面试题.pdf

上传人:dsmhb 2012/7/21 文件大小:0 KB

下载得到文件列表

javaSE面试题.pdf

文档介绍

文档介绍:1
JAVASE 部分
1、Choose the three valid identifiers from those listed below. (Choose
three)?
A. IDoLikeTheLongNameClass
B. $byte
C. const
D. _ok
E. 3_case
答:ABD

2、Which of the following lines of code pile without error (Choose
two)?
A.
int i=0;
if (i) {
(“Hi”);
}
B.
boolean b=true;
boolean b2=true;
if(b==b2) {
(“So true”);
}
C.
int i=1;
int j=2;
if(i==1|| j==2)
(“OK”);
D.
int i=1;
int j=2;
if (i==1 &| j==2)
(“OK”);
答:BC

3、Which two demonstrate a "has a" relationship(Choose two)?
A. public interface Person { }
public class Employee extends Person{ }
B. public interface Shape { }
public interface Rectandle extends Shape { }
C. public interface Colorable { }
public class Shape implements Colorable
{ }
D. public class Species{ }
Copyright Tarena Corporation, rights reserved
2
public class Animal{private Species species;}
E. ponent{ }
class Container ponent{
ponent[] children;
}
答:DE

4、What will happen when you attempt pile and run the following code?
public class Static{
static {
int x = 5;
}
static int x,y;
public static void main(String args[]){
x--;
myMethod();
(x + y + ++x);
}
public static void myMethod(){
y = x+++++x;
}
}
piletime error
: 1
: 2
: 3
: 7
: 8
答:D

5 、 What is the correct ordering for the import, class and package
declarations when found in a single file?
A. package, import, class
B. class, import, package
C. import, package, class
D. package, class, import
答:A

6、What will happen when you attempt pile and run the following code.
public class Pvf{
static boolean Paddy;
public static void main(String argv[]){
(Paddy);
}
}
Copyright Tarena Corporation, rights reserved
3
A. Com