Java 8 Features Flashcards

1
Q

1.Can you tell me the Java 8 Features

A

Lambda Expressions, Functional Interface, Stream API,
Default Methods, Optional Class, New Date and Time APi, Nashorn javascript engine, parallel array sorting, collectors, String Joiner Class

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

2.What are the Functions available in Functional Interface?

A

Predicate, Function, Consumer , Supplier
BiPredicate, BiFunction, BiConsumer

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

What is an Interface?

A

An interface or a protocol type that acts as a abstraction class

1.An interface have many number of abstract method
A class which implements the interface must give the implementations of that method
2. In interface explicitly we don’t want to mention the public abstract , by default abstract method in interface is public.

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

5.What is a Functional Interface?

A

A Functional interface is a interface , where it will be having only one abstract method and we can have many default and static methods.

1.We can use @FunctionalInterface Annotation to make sure that the compiler knows it.

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

6.Can we have default and static methods in Functional Interface?

A

Yes we can have default and static
methods in a Functional interface.

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

7.What is Marker interface?

A

An interface with no members or methods is known as Marker Interface.

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

Why Functional Interface have only one abstract method?

A

This Design servers several purposes , like Lambda expressions and method references.

1.Simplicity and clarity
2. Avoid Ambiquity

Enabling Lambda Expressions and Method References:

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

What the pre-defined functional Interface before Java 8?

A

1.Runnable
public abstract void run();
2.Callable
3.Comparator
int compare (T o1, T o2)
4.ActionListener Interface
public void actionPerfomed (ActionEvent e);

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