Java工程师笔试题和面试题答案
2021-08-10 07:57:07华夏高考网选择题
1:Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body?
A.synchronized
B.abstract
C.final
D.static
2:
Give the following java source fragement:
//point x
public class Interesting{
//do something
}
Which statement is correctly Java syntax at point x?
Give the following java source fragement:
//point x
public class Interesting{
//do something
}
Which statement is correctly Java syntax at point x?
A.public class MyClass{//do other thing…}
B.static int PI=3.14
C.class MyClass{//do something…}
D.none
3:
What is the result when you compile and run the following code?
public class Test
{
public void method()
{
for(int i = 0; i < 3; i++)
{
System.out.print(i);
}
System.out.print(i);
}
}
Choices:
What is the result when you compile and run the following code?
public class Test
{
public void method()
{
for(int i = 0; i < 3; i++)
{
System.out.print(i);
}
System.out.print(i);
}
}
Choices:
A.0122
B.0123
C.Compilation error
D.None of these
4: Which of the following statements are true?
A.The automatic garbage collection of the JVM Pvents programs from ever running out of memory
B.A program can suggest that garbage collection be performed and force it
C.Garbage collection is platform independent
D.An object becomes eligible for garbage collection when all references denoting it are set to null.
5:
Give the following method:
public void method( ){
String a,b;
a=new String(“hello world”);
b=new String(“game over”);
System.out.println(a+b+”ok”);
a=null;
a=b;
System.out.println(a);
}
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.
Give the following method:
public void method( ){
String a,b;
a=new String(“hello world”);
b=new String(“game over”);
System.out.println(a+b+”ok”);
a=null;
a=b;
System.out.println(a);
}
In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.
A.before line 5
B.before line 6
C.before line 7
D.before line 9
6:
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?
A.Change private int x to public int x
B.change private int x to static int x
C.Change private int x to protected int x
D.change private int x to final int x
7:
Given the following class definition:
class A{
protected int i;
A(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this class?
Select valid answer:
Given the following class definition:
class A{
protected int i;
A(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this class?
Select valid answer:
A.class B{ }
B.class B extends A{ }
C.class B extends A{ B(){System.out.println(“i=”+i);} }
D.class B{ class A{} }
8:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序?
相关推荐
- 中国点击率最高的一篇文章 !2021-12-23 01:49:29
- 中国银联笔试题和面试题答案2021-08-10 07:57:05
- 中国广东核电集团智力测试题2021-08-10 07:57:03
- 电子类笔试题和面试题答案2021-08-10 07:56:55
- 天津城市建设管理职业技术学院是公办还是民办?(现在学校口碑怎么样)2024-07-17 03:47:05
- 扬州大学是公办还是民办?(现在学校口碑怎么样)2024-07-17 03:44:16
- 中国政法大学是公办还是民办?(现在学校口碑怎么样)2024-07-17 03:42:56
- 晋中职业技术学院是公办还是民办?(现在学校口碑怎么样)2024-07-17 03:41:37
- 仰恩大学是公办还是民办?(现在学校口碑怎么样)2024-07-17 03:39:45
- 中国银联笔试题和面试题答案2021-08-10 07:57:05
- 中国广东核电集团智力测试题2021-08-10 07:57:03
- 电子类笔试题和面试题答案2021-08-10 07:56:55
最新发布
图文推荐
2025内蒙古高考征集志愿院校名单有哪
2024-07-17 08:39:362025西藏高考征集志愿院校名单有哪些
2024-07-17 08:35:17安徽农业大学是公办还是民办?(现在学
2024-07-17 03:54:02应天职业技术学院是公办还是民办?(现
2024-07-17 03:53:11黄冈科技职业学院是公办还是民办?(现
2024-07-17 03:51:47武汉商学院是公办还是民办?(现在学校
2024-07-17 03:49:37天津城市建设管理职业技术学院是公办
2024-07-17 03:47:05扬州大学是公办还是民办?(现在学校口
2024-07-17 03:44:16