Question 96

Given:

What is the result?
  • Question 97

    Given:
    public class Canvas implements Drawable {
    public void draw () { }
    }
    public abstract class Board extends Canvas { }
    public class Paper extends Canvas {
    protected void draw (int color) { }
    }
    public class Frame extends Canvas implements Drawable {
    public void resize () { }
    abstract void open ();
    }
    public interface Drawable {
    public abstract void draw ();
    }
    Which statement is true?
  • Question 98

    Given:

    and the code fragment:

    Which two code fragments, when inserted at line n1 independently, enable the code to print TruckCarBike?
  • Question 99

    Given the code fragments:
    class Caller implements Callable<String> {
    String str;
    public Caller (String s) {this.str=s;}
    public String call()throws Exception { return str.concat ("Caller");}
    }
    class Runner implements Runnable {
    String str;
    public Runner (String s) {this.str=s;}
    public void run () { System.out.println (str.concat ("Runner"));}
    }
    and
    public static void main (String[] args) InterruptedException, ExecutionException { ExecutorService es = Executors.newFixedThreadPool(2); Future f1 = es.submit (new Caller ("Call")); Future f2 = es.submit (new Runner ("Run")); String str1 = (String) f1.get(); String str2 = (String) f2.get();//line n1 System.out.println(str1+ ":" + str2);
    }
    What is the result?
  • Question 100

    Given the definition of the Book class:

    Which statement is true about the Book class?