Tài liệu Sun Certified Programmer for Java 2 Platform 1.4

Thảo luận trong 'Lập Trình' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    167
    Điểm thành tích:
    0
    Xu:
    0Xu
    QUESTION 1:
    Given:
    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.
    Answer: A
    QUESTION 2:
    Which two cause a compiler error? (Choose two)
    A. float[] = new float(3);
    B. float f2[] = new float[];
    C. float[] f1 = new float[3];
    D. float f3[] = new float[3];
    E. float f5[] = { 1.0f, 2.0f, 2.0f };
    F. float f4[] = new float[] { 1.0f. 2.0f. 3.0f};
    Answer: A, B
    The F. statement is incorrect. The float numbers should be separated with commas and not
    dots.
    QUESTION 3:
    Given:
    11. int i =1,j =10;
    12. do {
    13. if(i++> --j) {
    14. continue;
    15. }
     

    Các file đính kèm:

Đang tải...