CSC 224 -- Summary for Day4, June 27, 2001.

Practice Problems

  1. What is the difference between the lines
    String x = "a", y = "a";
    and
    String x = new String("a"), y = new String("a");

  2. When does the finalize method fire? Why shouldn't you trust it?

  3. True or False. All elements in an array are of the same type.

  4. What are the indices of the elements in this array?
    char[] x = {'a', 'b', 'c'};

  5. What is the output?
    int[] x = {7, 5, 2, 9};
    int i = 1, j = 4;
    x[i--] = x[--j]++;
    for(i = 1; i < 4; i++)
        System.out.print(x[i] + " " );

New Topics