Principais perguntas e respostas de entrevista e testes online
Plataforma educacional para preparacao de entrevistas, testes online, tutoriais e pratica ao vivo

Desenvolva habilidades com trilhas de aprendizado focadas, simulados e conteudo pronto para entrevistas.

WithoutBook reune perguntas de entrevista por assunto, testes praticos online, tutoriais e guias comparativos em um unico espaco de aprendizado responsivo.

Preparar entrevista

Core Java perguntas e respostas de entrevista

Test your skills through the online practice test: Core Java Quiz Online Practice Test

Pergunta 36. If you're overriding the method equals() of an object, which other method you might also consider?

hashCode()

Isto e util? Adicionar comentario Ver comentarios
 

Pergunta 37. What comes to mind when someone mentions a shallow copy and deep copy in Java?

Object cloning.

Java provides a mechanism for creating copies of objects called cloning. There are two ways to make a copy of an object called shallow copy and deep copy.
Shallow copy is a bit-wise copy of an object. A new object is created that has an exact copy of the values in the original object. If any of the fields of the object are references to other objects, just the references are copied. Thus, if the object you are copying contains references to yet other objects, a shallow copy refers to the same subobjects.
Deep copy is a complete duplicate copy of an object. If an object has references to other objects, complete new copies of those objects are also made. A deep copy generates a copy not only of the primitive values of the original object, but copies of all subobjects as well, all the way to the bottom. If you need a true, complete copy of the original object, then you will need to implement a full deep copy for the object.
Java supports shallow and deep copy with the Cloneable interface to create copies of objects. To make a clone of a Java object, you declare that an object implements Cloneable, and then provide an override of the clone method of the standard Java Object base class. Implementing Cloneable tells the java compiler that your object is Cloneable. The cloning is actually done by the clone method.

Isto e util? Adicionar comentario Ver comentarios
 

Pergunta 38. Can you instantiate the Math class?

You can't instantiate the math class. All the methods in this class are static. And the constructor is not public.

Isto e util? Adicionar comentario Ver comentarios
 

Pergunta 39. What's the difference between == and equals method?

equals checks for the content of the string objects while == checks for the fact that the two String objects point to same memory location ie they are same references.

Isto e util? Adicionar comentario Ver comentarios
 

Pergunta 40. What is the volatile modifier for?

The volatile modifier is used to identify variables whose values should not be optimized by the Java Virtual Machine, by caching the value for example. The volatile modifier is typically used for variables that may be accessed or modified by numerous independent threads and signifies that the value may change without synchronization.

Isto e util? Adicionar comentario Ver comentarios
 

Mais uteis segundo os usuarios:

Copyright © 2026, WithoutBook.