Most asked top Interview Questions and Answers & Online Test
Education platform for interview prep, online tests, tutorials, and live practice

Build skills with focused learning paths, mock tests, and interview-ready content.

WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.

Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address
WithoutBook LIVE Mock Interviews Java 8 Related interview subjects: 39

Interview Questions and Answers

Know the top Java 8 interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Total 30 questions Interview Questions and Answers

The Best LIVE Mock Interview - You should go through before interview

Know the top Java 8 interview questions and answers for freshers and experienced candidates to prepare for job interviews.

Interview Questions and Answers

Search a question to view the answer.

Intermediate / 1 to 5 years experienced level questions & answers

Ques 1

What is lambda expression?

Lambda expression is anonymous function which have set of parameters and a lambda (->) and a function body. You can call it function without name.

Structure of Lambda Expressions:
(Argument List) ->{expression;} or
(Argument List) ->{statements;}

For instance, the Runnable interface is a functional interface, so instead of:
Thread thread = new Thread(new Runnable() {
    public void run() {
        System.out.println("Hello World!");
    }
});
 
Using Lambda you can simply do the following:
Thread thread = new Thread(() -> System.out.println("Hello World!"));

Functional interfaces are usually annotated with the @FunctionalInterface annotation - which is informative and does not affect the semantics.
Save For Revision

Save For Revision

Bookmark this item, mark it difficult, or place it in a revision set.

Open My Learning Library
Is it helpful?
Add Comment View Comments
Ques 2

Given a list of employees, sort all the employee on the basis of age by using java 8 APIs only.

You can simply use sort method of list to sort the list of employees.
List<Employee> employeeList = createEmployeeList();
        employeeList.sort((e1,e2)->e1.getAge()-e2.getAge());
        employeeList.forEach(System.out::println);
Save For Revision

Save For Revision

Bookmark this item, mark it difficult, or place it in a revision set.

Open My Learning Library
Is it helpful?
Add Comment View Comments
Ques 3

Given the list of employees, find the employee with name 'John' using Java 8 API.

Check the following code:
List<Employee> employeeList = createEmployeeList();
        Optional<Employee> e1 = employeeList.stream()
                  .filter(e->e.getName().equalsIgnoreCase("Mary")).findAny();
        if(e1.isPresent())
            System.out.println(e1.get());
Save For Revision

Save For Revision

Bookmark this item, mark it difficult, or place it in a revision set.

Open My Learning Library
Is it helpful?
Add Comment View Comments
Ques 4

Given a list of employee, find maximum age of employee using Java 8 API.

Check the following code:
List<Employee> employeeList = createEmployeeList();
        OptionalInt max = employeeList.stream().
                          mapToInt(Employee::getAge).max();
        if(max.isPresent())
            System.out.println("Maximum age of Employee: "+max.getAsInt());
Save For Revision

Save For Revision

Bookmark this item, mark it difficult, or place it in a revision set.

Open My Learning Library
Is it helpful?
Add Comment View Comments

Most helpful rated by users:

Copyright © 2026, WithoutBook.