Which four can be thrown using the throw statement?()
AError
BEvent
CObject
DThrowable
EException
FRuntimeException
相关问题推荐
-
import java.io.*; public class Forest implements Serializable { private Tree tree = new Tree(); public static void main(String [] args) { Forest f= new Forest(); try { FileOutputStream fs = new FileOutputStream(”Forest.ser”); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(f); os.close(); } catch (Exception ex) { ex.printStackTrace(); } } } class Tree { } What is the result?()
A、 Compilation fails.
B、 An exception is thrown at runtime.
C、 An instance of Forest is serialized.
D、 A instance of Forest and an instance of Tree are both serialized.
-
What is the result?()
A、 Cat
B、 Dog
C、 Compilation fails.
D、 The code runs with no output.
E、 An exception is thrown at runtime.
-
What is the result?()
A、 three
B、 other
C、 An exception is thrown at runtime.
D、 Compilation fails because of an error on line 12.
E、 Compilation fails because of an error on line 13.
F、 Compilation fails because of an error on line 15.
-
ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[] args) { 5. char a = new ClassOne().getVar();6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()
A、 Compilation fails.
B、 Compilation succeeds and no exceptions are thrown.
C、 An exception is thrown at line 5 in ClassTest.java.
D、 An exception is thrown at line 6 in ClassTest.java.
-
A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?()
A、 A
B、 B
C、 C
D、 D