21.b). Replace X with '&&'
短路运算符

解决方案 »

  1.   

    Question 19)
    You are browsing the Java HTML documentation for information on the java.awt.TextField component. You want to create Listener code to respond to focus events. The only Listener method listed is addActionListener. How do you go about finding out about Listener methods.
    1) Define your own Listener interface according to the event to be tracked
    2) Use the search facility in the HTML documentation for the listener needed
    3) Move up the hierarchy in the HTML documentation to locate methods in base 
    classes
    4) Subclass awt.event with the appropriate Listener methodQuestion 21:)4
    In the following code fragment from an applet, we know that the getParameter call may return a null if there is no parameter named size. Which logical operator should replace X in line 5 to ensure that a NullPointerException is not generated if tmp is null.
    1. int sz;
    2. public void init(){
    3. sz=10;
    4. String tmp=getParameter("size");
    5. if(tmp!=null X tmp.equals("BIG")) sz=20;
    6. }
    a). Replace X with '&'
    b). Replace X with '&&'
    c). Replace X with '|'
    d). Replace X with '||'
    Question 24: [Check all correct answers]
    Once created, some Java objects are "immutable", meaning they can not have their contents changed. Which of the following classed produce immutable objects?
    a. java.lang.Double
    b. java.lang.StringBuffer
    c. java.lang.Boolean
    d. java.lang.MathQuestion 46: Given the following class definition:
    class A {
       protected int i;
       A(int i) {
          this.i = i;
       }
    }
    Which of the following would be a valid inner class for this class?
    Select all valid answers.
    a)
    class B {
    }
    b)
    class B extends A {
    }
    c)
    class B {
       B() { 
          System.out.println("i = " + i);
       }
    }
    d)
    class B {
       class A {
       }
    }
    e)
    class A {
    }
    Question47: What statements are true concerning the method notify() that is used in conjunction with wait()? d
    Select all valid answers.
    a) if there is more than one thread waiting on a condition, only the thread that has been waiting the longest is notified
    b) if there is more than one thread waiting on a condition,there is no way to predict which thread will be notifed
    c) notify() is defined in the Thread class
    d) it is not strictly necessary to own the lock for the object you invoke notify() for
    e) notify() should only be invoked from within a while loopQuestion 52: You have an 8-bit file using the character set defined by ISO 8859-8. You are writing an application to display this file in a TextArea. The local encoding is already set to 8859-8. How can you write a chunk of code to read the first line from this file?
    You have three variables accessible to you:
    ? myfile is the name of the file you want to read 
    ? stream is an InputStream object associated with this file 
    ? s is a String object 
    Select all valid answers.
    a)
    InputStreamReader reader = new InputStreamReader(stream, "8859-8");
    BufferedReader buffer = new BufferedReader(reader);
    s = buffer.readLine();
    b)
    InputStreamReader reader = new InputStreamReader(stream);
    BufferedReader buffer = new BufferedReader(reader);
    s = buffer.readLine();
    c)
    InputStreamReader reader = new InputStreamReader(myfile, "8859-8");
    BufferedReader buffer = new BufferedReader(reader);
    s = buffer.readLine();
    d)
    InputStreamReader reader = new InputStreamReader(myfile);
    BufferedReader buffer = new BufferedReader(reader);
    s = buffer.readLine();
    e)
    FileReader reader = new FileReader(myfile);
    BufferedReader buffer = new BufferedReader(reader);
    s = buffer.readLine();Question 19  bc
    Which of the following are organizing principles of Java's "javadoc" format documentation for a given class?
    a) Relative frequency of use of the various methods.
    b) Lists of methods in a class in alphabetic order.
    c) Separate listing of private, protected and public methods in a class.
    Q. 33   a
    With which I/O operation can we append, update a file?
    a) RandomAccessFile()
    b) Outputstream()
    c) DataOutputstream()
      

  2.   

    GUI和I/O都不考了,你在这里贴这么几道题目干吗呢!