Question 31) Which of the following statements are true? 1) The default layout manager for an Applet is FlowLayout 2) The default layout manager for a Frame is FlowLayout 3) A layout manager must be assigned to an Applet before the setSize method is called 4) The FlowLayout manager attempts to honor the preferred size of any components
Question 32) Which of the following statements are true about a variable created with the static modifier?
1) Once assigned the value of a static variable may not be altered 2) A static variable created in a method will keep the same value between calls 3) Only one instance of a static variable will exist for any amount of class instances 4) The static modifier can only be applied to a primitive value
Question 33) Which of the following statements are true? 1) Java uses a system called UTF for I/O to support international character sets 2) The RandomAccessFile is the most suitable class for supporting international character sets 3) An instance of FileInputStream may not be chained to an instance of FileOutputStream 4) File I/O activities requires use of Exception handling
Question 34) What will happen when you attempt to compile and run the following code? import java.io.*. class ExBase{ abstract public void martley(){ }
}
public class MyEx extends ExBase{ public static void main(String argv[]){ DataInputStream fi = new DataInputStream(System.in). try{ fi.readChar(). }catch(IOException e){ System.exit(0). } finally {System.out.println("Doing finally").} } }
1) Compile time error 2) It will run, wait for a key press and then exit 3) It will run, wait for a keypress, print "Doing finally" then exit 4) At run and immediately exit转贴于