Can you cite methods from the Object class? - Cracking the Java Coding Interview

preview_player
Показать описание
Cracking the #Java #Coding #Interview - Question 3: Can you cite methods from the Object class?
Рекомендации по теме
Комментарии
Автор

I never got why clone is so controversial. In theory it should be pretty simple. Returns a shallow copy of the current object. There are cases where this is exactly what you might want. Especially with sealed hierarchies the problem with unexpected inheritance and clone is gone. An interface "SafeCloneable" that disallows "CloneNotSupportedException" might be a useful in open inheritance hierarchies.

redcrafterlppa
Автор

Effective Java says clone() is fine with arrays.

justsignmeup
Автор

What can I use instead of clone method?

pesterstone
Автор

do we have to copy array (shallow copy) with System.arraycopy? I use clone in that case

JorgetePanete
Автор

I love Java and also the method clone() and finalize(). Why those methods are deprecated? :(

AbdullahAlMamun-fhgs
Автор

we love Java programming language & we love also mister JOSE PAUMARD <3 <3

FiviPesto
Автор

why, why, why, why would someone ask such question...

----------