益模软件Java笔试题
2023-07-06
java笔试题目
QUESTION NO: 1
1. public class Test
2. public static void main(String args[])
3. class Foo
4. public int i = 3;
5.
6. Object o = (Object)new Foo();
7. Foo foo = (Foo)o;
8. System.out.println(“i = “ + foo.i);
9.
10.
What is the result?
A. i = 3
B. Compilation fails.
C. A ClassCastException is thrown at line 6.
D. A ClassCastException is thrown at line 7.
QUESTION NO: 2
11. int i =1,j =10;
12. do
13. if(i++> –j)
14. continue;
15.
16. while (i j)
14. break;
15.
16. j–;
17. while (++i