Java5 Flashcards

1
Q

What is a parameterized or generic type?

A

generic type is a generic class or interface that is parameterized over types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can we use parameterized types in exception handling?

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a wildcard parameterized type?

A

? extends A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Autoboxing and what are its advantages/pitfalls?

A

primitive types => corresponding wrapper classes
pitfalls- comparison, npe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Problems Enum type solves
(comparing to “public static int” enum pattern)

A

list of constants, singleton

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can we add something to List> ?

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are Annotations and which predefined by the language specification
does one know

A

annotation is metadata.
(@Deprecated, @Override, @SuppressWarnings)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to create custom annotation? What is retention type?

A

public @interface A{}
retention type - when annotations will be visible
CLASS, SOURCE, RUNTIME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Lambda expression ? (Java 8)

A

anonymous methods used to implement a method defined by a functional interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is method reference ? (Java 8)

A

static method ref
instance method ref
constructor ref

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is default metod ? (Java 8)

A

interface methods with implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly