Tag Archives: compile

Given: (Exhibit) What must be added in line 1 to compile this class?

Given:What must be added in line 1 to compile this class? A. catch(FileNotFoundException | IOException e) { } B. catch(IndexOutOfBoundsException e) { }catch(FileNotFoundException e) { } C. catch(FileNotFoundException e) { }catch(IndexOutOfBoundsException e) { } D. catch(IOException e) { } E. catch(FileNotFoundException | IndexOutOfBoundsException e) { } Correct Answer: D

Given the code fragment (Exhibit) Which code fragments, inserted independently, enable the code compile?

Given the code fragmentWhich code fragments, inserted independently, enable the code compile? A. fvar = 200; cvar = 400; B. this.fvar = 200; Test2.cvar = 400; C. this.fvar = 200; this.cvar = 400; D. t.fvar = 200; E. cvar = 400; F. t.fvar = 200; Test2.cvar = 400; Correct Answer: E

Given: (Exhibit) Which two changes need to be made to make this class compile? (Choose two.)

Given:Which two changes need to be made to make this class compile? (Choose two.) A. Change Line 1 to an abstract class:public abstract class API { B. Change Line 1 to extend java.lang.AutoCloseable:public interface API extends AutoCloseable { C. Change Line 1 to a class:public class API { D. Change Line 2 to an abstract method:public abstract void… Read More »

Given: (Exhibit) Which two changes need to be made to make this class compile? (Choose two.)

Given:Which two changes need to be made to make this class compile? (Choose two.) A. Change Line 2 access modifier to protected:protected void checkValue(Object value)throws IllegalArgumentException; B. Change Line 1 to extend java.lang.AutoCloseable:public interface API extends AutoCloseable { C. Change Line 2 to an abstract method:public abstract void checkValue(Object value)throws IllegalArgumentException; D. Change Line 1 to an abstract… Read More »

Given the code fragments: (Exhibit) Which modification enables the code to compile?

Given the code fragments:Which modification enables the code to compile? A. Replace line n1 with:import p1. A;Replace line n2 with:import p1.*; B. Replace line n1 with:import p1.*;Replace line n2 with:import p1. p2.*; C. Replace line n1 with:import p1;Replace line n2 with:import p1;import p1. p2; D. Replace line n1 with:import p1. A;Replace line n2 with:import p1. A;import p1. p2.B… Read More »

Given: (Exhibit) Which two independent changes will make the Main class compile? (Choose two.)

Given:Which two independent changes will make the Main class compile? (Choose two.) A. Move the entire Student class declaration to a separate Java file, Student.java. B. Change line 2 to public Student(String classname). C. Change line 1 to public class Student {. D. Change line 3 to Student student = new Student(“Biology”);. E. Change line 1 to static… Read More »