QUESTION 52자격증/OCJP_ExamB2018. 7. 13. 21:14
Table of Contents
반응형
QUESTION 52Given: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. An instance of Forest and an instance of Tree are both serialized.Solution : B
plus imformation
java.io.FileNotFoundException: Forest.ser (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:84)
at Forest.main(Main.java:8)
반응형
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 54 (0) | 2018.07.13 |
---|---|
QUESTION 53 (0) | 2018.07.13 |
QUESTION 51 (0) | 2018.07.13 |
QUESTION 50 (0) | 2018.07.13 |
QUESTION 49 (0) | 2018.07.13 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상