Java5 Flashcards
What is a parameterized or generic type?
generic type is a generic class or interface that is parameterized over types.
Can we use parameterized types in exception handling?
no
What is a wildcard parameterized type?
? extends A
What is Autoboxing and what are its advantages/pitfalls?
primitive types => corresponding wrapper classes
pitfalls- comparison, npe
Problems Enum type solves
(comparing to “public static int” enum pattern)
list of constants, singleton
Can we add something to List> ?
no
What are Annotations and which predefined by the language specification
does one know
annotation is metadata.
(@Deprecated, @Override, @SuppressWarnings)
How to create custom annotation? What is retention type?
public @interface A{}
retention type - when annotations will be visible
CLASS, SOURCE, RUNTIME
What is Lambda expression ? (Java 8)
anonymous methods used to implement a method defined by a functional interface
What is method reference ? (Java 8)
static method ref
instance method ref
constructor ref
What is default metod ? (Java 8)
interface methods with implementation