Question 16
In Java, what is an 'Interface' prior to Java 8 specifications?
Option B is correct. Prior to Java 8, interfaces contained only 100% abstract methods (without bodies) and public static final constant fields.
In Java, what is an 'Interface' prior to Java 8 specifications?
Option B is correct. Prior to Java 8, interfaces contained only 100% abstract methods (without bodies) and public static final constant fields.
Which Java 8 feature allows interfaces to include method implementations without breaking existing implementing classes?
Option E is correct. Java 8 introduced 'default' methods in interfaces, allowing developers to add new method implementations to interfaces without breaking backward compatibility.
What is a Functional Interface in Java?
Option C is correct. A Functional Interface (annotated with @FunctionalInterface) contains exactly one abstract method, serving as the target type for $\Lambda Expressions$ in Java 8+.
Which keyword is used in Java to implement an interface inside a class declaration?
Option B is correct. The 'implements' keyword is used by a class to fulfill the contract defined by one or more interfaces.
What is the default initial value of an uninitialized instance variable of reference type (e.g., Object obj;) in a Java class?
Option B is correct. In Java, instance variables of object reference types default to 'null' when not explicitly initialized.