Consider the following code.
Please list which lines below will not compile. (choose all that apply)
1. public class acd {
2. public static void main(String arg[])
3. {
4. Object obj1 = new Object();
5. char c = 3;
6. short s = 41;
7. byte b = 41;
8. s = b*b;
9. Double d = new Double(4.12f);
10. Float f = new Double(2.33);
11. d = obj1;
12. Float []ff = new Float[5];
13. float f1 = ff[0];
14. obj1 = ff;
15. obj1 = ff[5];
16. }
17. }
Consider the source code of the following class
UIDTest
1.class UIDTest
2. {
3. long testing (float a, float b) {return 0;}
4.
5. }
Which one of the following methods would be legal, at line 4 in class UIDTest. (choose all that apply)
a. String testing (float a, float b){ return “acd”;}
b. long testing (float a, float b, int i ) { return 0;}
c. long testing (float a, float b ) throws Exception { return ‘0’;}
d. float testing (float a, int b ) { return 0.01;}
e. double testing (float a, int b, int c ) { return 1e10;}
True or False: In the code fragment below, line 4 is executed.
1. String s1 = “UID”
2. String s2 = “UID”
3. if(s1 == s2)
4. System.out.println(“ UID is printed”);
A. TrueB. False
Given a string constructed by calling s = new String(“Hung”), which of the call listed below modify the string? (choose all that apply)A. s. append(“xxx”);
B. s.trim();
C. s.substring(3)
D. s.replace(‘z’.’a’);E. s.concat(s);F. Non of the above
Which would be the most suitable for storing data elements that must not appear in the store more than once, if searching is not a priority?
A. java.util.Collection
B. java.util.List
C. java.util.Set
D. java.util.Map
E. java.util.VectorF. java.util.HashSet
Which one of the following statements is true? (choose all that apply)
A. Transient methods may not be overridden.
B. Transient classes may not be serialized.
C. Transient variables must be static.
D. Transient variables are not serialized.
Consider the source code of the following source code, which is in UIDTest.java
1. class Test
2. {
3. long result (float a, float b) {return 0;}
4. }
5. public class UIDTest extends Test
6. {
7.
8. }
Which of the following method would be legal (individual), at line 7. (choose all that apply)
a. public long result (float a, float b) {return 0;}
b. public long result (float a, float b) throws Exception {return 0;}
c. public long result (float a, float b, int c) {return 0;}
d. public long result (float a, float b, int c) throw Exception {return 0;}
e. public String result2 (float a, float b) throw Exception {return "0";}
f. public String result2(float a, float b) {return "0"; }
Which of the following are true. (choose all that apply)
a String is not thread-safe
b StringBuffer should be used when localization is required
c String is immutable while StringBuffer is not.
d StringBuffer is the buffer for String.
e String and stringBuffer are identical.
What will the following program print when method print1 of B is executed? (choose all that apply)
interface I{
void foo();}
class B implements I{
void print1() { print2(this); }
void print2(I i) { i.foo(); }
void print2_this() { System.out.println("Surprise"); }
public void foo() { System.out.println("Hello"); }}
a Hello
b Surprise
c the program will not compile
d “Hello”
e “Surprise”
How many threads can potentially access one servlet instance
a always only one
b multiple
c exactly two: one created by the JVM another by the servlet container
d zero
e wrong question.
Please list which lines below will not compile. (choose all that apply)
1. public class acd {
2. public static void main(String arg[])
3. {
4. Object obj1 = new Object();
5. char c = 3;
6. short s = 41;
7. byte b = 41;
8. s = b*b;
9. Double d = new Double(4.12f);
10. Float f = new Double(2.33);
11. d = obj1;
12. Float []ff = new Float[5];
13. float f1 = ff[0];
14. obj1 = ff;
15. obj1 = ff[5];
16. }
17. }
Consider the source code of the following class
UIDTest
1.class UIDTest
2. {
3. long testing (float a, float b) {return 0;}
4.
5. }
Which one of the following methods would be legal, at line 4 in class UIDTest. (choose all that apply)
a. String testing (float a, float b){ return “acd”;}
b. long testing (float a, float b, int i ) { return 0;}
c. long testing (float a, float b ) throws Exception { return ‘0’;}
d. float testing (float a, int b ) { return 0.01;}
e. double testing (float a, int b, int c ) { return 1e10;}
True or False: In the code fragment below, line 4 is executed.
1. String s1 = “UID”
2. String s2 = “UID”
3. if(s1 == s2)
4. System.out.println(“ UID is printed”);
A. TrueB. False
Given a string constructed by calling s = new String(“Hung”), which of the call listed below modify the string? (choose all that apply)A. s. append(“xxx”);
B. s.trim();
C. s.substring(3)
D. s.replace(‘z’.’a’);E. s.concat(s);F. Non of the above
Which would be the most suitable for storing data elements that must not appear in the store more than once, if searching is not a priority?
A. java.util.Collection
B. java.util.List
C. java.util.Set
D. java.util.Map
E. java.util.VectorF. java.util.HashSet
Which one of the following statements is true? (choose all that apply)
A. Transient methods may not be overridden.
B. Transient classes may not be serialized.
C. Transient variables must be static.
D. Transient variables are not serialized.
Consider the source code of the following source code, which is in UIDTest.java
1. class Test
2. {
3. long result (float a, float b) {return 0;}
4. }
5. public class UIDTest extends Test
6. {
7.
8. }
Which of the following method would be legal (individual), at line 7. (choose all that apply)
a. public long result (float a, float b) {return 0;}
b. public long result (float a, float b) throws Exception {return 0;}
c. public long result (float a, float b, int c) {return 0;}
d. public long result (float a, float b, int c) throw Exception {return 0;}
e. public String result2 (float a, float b) throw Exception {return "0";}
f. public String result2(float a, float b) {return "0"; }
Which of the following are true. (choose all that apply)
a String is not thread-safe
b StringBuffer should be used when localization is required
c String is immutable while StringBuffer is not.
d StringBuffer is the buffer for String.
e String and stringBuffer are identical.
What will the following program print when method print1 of B is executed? (choose all that apply)
interface I{
void foo();}
class B implements I{
void print1() { print2(this); }
void print2(I i) { i.foo(); }
void print2_this() { System.out.println("Surprise"); }
public void foo() { System.out.println("Hello"); }}
a Hello
b Surprise
c the program will not compile
d “Hello”
e “Surprise”
How many threads can potentially access one servlet instance
a always only one
b multiple
c exactly two: one created by the JVM another by the servlet container
d zero
e wrong question.
解决方案 »
- 求一个算法
- 高分求助 请问 什么情况下我的异常显示为(unknow source)
- 有关CLOB的问题:循环多次插入大对象字段的问题,希望用过大对象的朋友能帮助我解决,谢谢!~
- 拜!再拜!关于jsp环境配置的问题。
- ResultSet is closed Exception
- 怎么在CSS和XML中动态加载图片路径?
- eclipse编译问题!
- 我在IE启动下启动WORD,怎么样控制WORD的初始页面格式为A4或者A3呢??
- awt和swing有何不同?
- 怎样才算正确的关闭weblogic呢,还有,我的老板想要买一个正版的weblogic,大约需要多少钱呀?
- 学习JAVA,碰到内部类和抽象类的问题.请进,顶有分!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- <T> <E> 这些东西是干什么的 有什么用、。?
b e
b
c e
d f
c
a c f
bc
a
b
以上是我的答案
如有错误之处请楼下高手指点
b
B
C,E
C,F(?)
A(?)
a,c,d,e,f
c(StringBuffer should be used when localization is required?)
a
最后一道不会
a、c
a
f
c
这个不会,不知道什么是transient class/variable
b
c
a