Page 1 of 1

Given:public class SampleClass {public static void main(String[] args) {SampleClass sc = new SampleClass();sc.processCD(

Posted: Wed Jun 07, 2023 6:11 am
by answerhappygod
Given:public class SampleClass {public static void main(String[] args) {SampleClass sc = new SampleClass();sc.processCD();private void processCD() {try (CDStream cd = new CDStream()) {cd.open();cd.read();cd.write("lullaby");cd.close();} catch (Exception e) {System.out.println("Exception thrown");class CDStream {String cdContents = null;public void open() {cdContents = "CD Contents";System.out.println("Opened CD stream");public String read() throws Exception {throw new Exception("read error");public void write(String str) {System.out.println("CD str is: " + str);public void close() {cdContents = null;What is the result?

A. Compilation CD stream
B. Opened CD thrown
C. Exception thrown
D. Opened CD stream CD str is: lullaby