单项选择题Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?()  

A.Vector filelist = ((Directory) file).getList();
B.String[] filelist = file.directory();
C.Enumeration filelist = file.contents();
D.String[] filelist = file.list();
E.Vector filelist = (new Directory(file)).files();


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()  

A.FileOutputStream has no constructors matching the given arguments.
B.An IOExeception will be thrown if a file named "data" already exists.
C.An IOExeception will be thrown if a file named "data" does not already exist.
D.If a file named "data" exists, its contents will be reset and overwritten.
E.If a file named "data" exists, output will be appended to its current contents.

3.多项选择题Which statements concerning the event model of the AWT are true?()  

A.At most one listener of each type can be registered with a component.
B.Mouse motion listeners can be registered on a List instance.
C.There exists a class named ContainerEvent in package java.awt.event.
D.There exists a class named MouseMotionEvent in package java.awt.event.
E.There exists a class named ActionAdapter in package java.awt.event.

4.单项选择题

What will be the appearance of an applet with the following init() method?  
public void init() {  
add(new Button("hello"));  }  

A.Nothing appears in the applet.
B.A button will cover the whole area of the applet.
C.A button will appear in the top left corner of the applet.
D.A button will appear, centered in the top region of the applet.
E.A button will appear in the center of the applet.

6.单项选择题Which statements concerning the switch construct are true?()  

A.All switch statements must have a default label.
B.There must be exactly one label for each code segment in a switch statement.
C.The keyword continue can never occur within the body of a switch statement.
D.No case label may follow a default label within a single switch statement.
E.A character literal can be used as a value for a case label.

8.多项选择题Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?()  

A.Member variables of the outer instance are always accessible to inner instances, regardless of their      accessibility modifiers.
B.Member variables of the outer instance can never be referred to using only the variable name within     the inner instance.
C.More than one inner instance can be associated with the same outer instance.
D.All variables from the outer instance that should be accessible in the inner instance must be declared     final.
E.A class that is declared final cannot have any inner classes.

9.多项选择题Which statements concerning the methods notify() and notifyAll() are true?  

A.Instances of class Thread have a method called notify().
B.A call to the method notify() will wake the thread that currently owns the monitor of the object.
C.The method notify() is synchronized.
D.The method notifyAll() is defined in class Thread.
E.When there is more than one thread waiting to obtain the monitor of an object, there is no way to be     sure which thread will be notified by the notify() method.