Preguntas y respuestas de entrevista mas solicitadas y pruebas en linea
Plataforma educativa para preparacion de entrevistas, pruebas en linea, tutoriales y practica en vivo

Desarrolla tus habilidades con rutas de aprendizaje enfocadas, examenes de practica y contenido listo para entrevistas.

WithoutBook reune preguntas de entrevista por tema, pruebas practicas en linea, tutoriales y guias comparativas en un espacio de aprendizaje responsivo.

Preparar entrevista
Entrevistas simuladas LIVE de WithoutBook Java 8 Temas de entrevista relacionados: 39

Interview Questions and Answers

Conoce las principales preguntas y respuestas de entrevista de Java 8 para principiantes y candidatos con experiencia para prepararte para entrevistas laborales.

Total de preguntas: 30 Interview Questions and Answers

La mejor entrevista simulada en vivo que deberias ver antes de una entrevista

Conoce las principales preguntas y respuestas de entrevista de Java 8 para principiantes y candidatos con experiencia para prepararte para entrevistas laborales.

Interview Questions and Answers

Busca una pregunta para ver la respuesta.

Preguntas y respuestas para nivel principiante / recien graduados

Pregunta 1

What are new features which got introduced in Java 8?

There are lots of new features which were added in Java 8. Here is the list of important features:
  • Lambda Expression
  • Stream API
  • Default methods in the interface
  • Functional Interface
  • Optional
  • Method references
  • Date API
  • Nashorn, JavaScript Engine
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 2

Can you explain the syntax of Lambda expression?

So we can divide structure of Lambda expression to three parts:
  • Arguments
  • Array Token
  • Statements
1. Argument list or parameters
Lambda expression can have zero or more arguments. First part before '->' is called as argument list or parameters.
()->{System.out.println("Hello")}; //Without argument, will print hello 
(int a)->{System.out.println(a)} //; One argument, will print value of a
(int a,int b)-> {a+b};//two argument, will return sum of these two integers

2. Array token (->)

3. Body
  • Body can have expression or statements.
  • If there is only one statement in body, curly brace is not needed and return type of the anonymous function is same as of  body expression.
  • If there are more than one statements, then it should be in curly braces and return type of anonymous function is same as value return from code block, void if nothing is returned.
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 3

What are functional interfaces?

  • Functional interfaces are those interfaces which can have only one abstract method. It can have static method, default methods or can override Object’s class methods.
  • There are many functional interfaces already present in java such as Comparable, Runnable.
  • As we have only one method in Runnable, hence it is considered as functional interface.
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 4

What Is a Default Method and When Do We Use It?

A default method is a method with an implementation – which can be found in an interface.
We can use a default method to add a new functionality to an interface while maintaining backward compatibility with classes that are already implementing the interface:
public interface CarBehaviour {
    public void move();
    default void peep() {
        System.out.println("peep!");
    }
}
Usually, when a new abstract method is added to an interface, all implementing classes will break until they implement the new abstract method. In Java 8, this problem has been solved by the use of default method.
For example, Collection interface does not have forEach method declaration. Thus, adding such method would simply break the whole collections API.
Java 8 introduces default method so that Collection interface can have a default implementation of forEach method without requiring the classes implementing this interface to implement the same.
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 5

What is Optional and how can we use it?

Optional is a container object used to contain not-null objects. Optional object is used to represent null with absent value. This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.
Following is the declaration for java.util.Optional<T> class:
public final class Optional<T> extends Object

Coding Example:
import java.util.Optional;
public class OptionalTester {
   public static void main(String args[]) {
      OptionalTester optionalTester = new OptionalTester();
      Integer value1 = null;
      Integer value2 = new Integer(10);
      //Optional.ofNullable - allows passed parameter to be null.
      Optional<Integer> a = Optional.ofNullable(value1);
      //Optional.of - throws NullPointerException if passed parameter is null
      Optional<Integer> b = Optional.of(value2);
      System.out.println(optionalTester.sum(a,b));
   }
   public Integer sum(Optional<Integer> a, Optional<Integer> b) {
      //Optional.isPresent - checks the value is present or not
      System.out.println("First parameter is present: " + a.isPresent());
      System.out.println("Second parameter is present: " + b.isPresent());
      //Optional.orElse - returns the value if present otherwise returns
      //the default value passed.
      Integer value1 = a.orElse(new Integer(0));
      //Optional.get - gets the value, value should be present
      Integer value2 = b.get();
      return value1 + value2;
   }
}

It should produce the following output:
First parameter is present: false
Second parameter is present: true
10
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 6

Provide some APIs of Java 8 Date and Time.

LocalDate, LocalTime, and LocalDateTime are the Core API classes for Java 8. As the name suggests, these classes are local to context of observer. It denotes current date and time in context of Observer.
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios
Pregunta 7

How will you get current date and time using Java 8 Date and TIme API?

You can simply use now() method of LocalDate to get today’s date.
LocalDate currentDate = LocalDate.now();
System.out.println(currentDate);

Output:
2017-09-09

You can use now() method of LocalTime to get current time.
LocalTime currentTime = LocalTime.now();
System.out.println(currentTime);
 
Output:
23:17:51.817
Guardar para repaso

Guardar para repaso

Guarda este elemento en marcadores, marcalo como dificil o agregalo a un conjunto de repaso.

Abrir mi biblioteca de aprendizaje
Es util?
Agregar comentario Ver comentarios

Lo mas util segun los usuarios:

Copyright © 2026, WithoutBook.