Question: What is the result of executing the following code?
1 import java.io.*; 2 class Channel {} 3 public class TVSet implements Serializable { 4 private String brand; 5 private transient int year; 6 private Channel channel; 7 8 public String getBrand() {return this.brand;} 9 public void setBrand(String brand) {this.brand = brand;} 10 public int getYear() { return year;} 11 public void setYear(int year) { this.year = year;} 12 public Channel getChannel() { return channel;} 13 public void setChannel(Channel channel) {this.channel = channel;} 14 15 public static void main(String[] args) { 16 try(ObjectInputStream in = new ObjectInputStream( 17 new BufferedInputStream(new FileInputStream("tv.dat")))) { 18 TVSet tv = in.readObject(); 19 } catch (Exception e) {e.printStackTrace();} 20 } 21 }
Choice:
A. The code compiles and runs without any output.
B. The code compiles but prints Exception at line 19.
C. The code doesn't compile because of line 1.
D. The code doesn't compile because of line 3.
E. The code doesn't compile because of line 16-17.
F. The code doesn't compile because of other lines.