Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

Java 8 — Real-Time Coding Interview Questions and Answers

Anusha SP
Dev Genius
Published in
5 min readJul 4, 2023

As I have already shared the Java 8 Coding and Programming Interview Questions and Answers and questions on Stream API in Java 8 Stream API Interview Questions and Answers. Keeping in mind that, you already know the basics of using the Java 8 concepts. In this article let us try some real-time questions.

We will use the below Employee class employeeList as an example to solve the questions.

public class Employee {

int id;
String name;
int age;
String gender;
String department;
int yearOfJoining;
double salary;

public Employee(int id, String name, int age, String gender, String department, int yearOfJoining, double salary)
{
this.id = id;
this.name = name;
this.age = age;
this.gender = gender;
this.department = department;
this.yearOfJoining = yearOfJoining;
this.salary = salary;
}
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public String getGender()
{
return gender;
}
public String getDepartment()
{
return department;
}
public int getYearOfJoining()
{
return yearOfJoining;
}
public double getSalary()
{
return salary;
}
@Override
public String toString()
{
return "Id : "+id
+", Name : "+name
+", age : "+age
+", Gender : "+gender
+", Department : "+department
+", Year Of Joining : "+yearOfJoining
+", Salary : "+salary;
}

public static void main(String[] args) {
List<Employee> employeeList = new ArrayList<Employee>();

employeeList.add(new Employee(111, "Jiya Brein", 32, "Female", "HR", 2011, 25000.0));
employeeList.add(new Employee(122, "Paul Niksui", 25, "Male", "Sales And Marketing", 2015, 13500.0));
employeeList.add(new Employee(133, "Martin Theron", 29, "Male", "Infrastructure", 2012, 18000.0));
employeeList.add(new Employee(144, "Murali Gowda", 28, "Male", "Product Development", 2014, 32500.0));
employeeList.add(new Employee(155, "Nima Roy", 27, "Female", "HR", 2013, 22700.0));
employeeList.add(new Employee(166

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Anusha SP

Software Developer | Technical Content Writer | Freelancer | Aiming to Understand the technologies well

Responses (4)

Write a response