RUVIDEO
Поделитесь видео 🙏

java.lang package Interview Question and Answer part-1

📁 Лайфстайл 👁️ 16 📅 05.12.2023

java.lang package Interview Question and Answer part-1

java.lang package Interview Question

java.lang package Interview Question and answers

How many methods are available in Object class
Difference between == operator and .equals() method
What is Clone() method and Its type with differences

Question 1 : How many methods are available in Object class ?

Answer: 11 Methods

toString() , hashCode() , equals(Object o) , clone() , getClass(), finalize() , wait() , wait(long ms) , wait(long ms, int ns) , notify() , notifyAll().



Question 2: Difference between == operator and .equals() method ?



Answer:

Difference-1

== operator is applicable for both primitives and Object references .



.equals() method is applicable for Object reference but not for primitives.

Difference-2

In the case of Object reference == operator is always meant for reference comparison . If two references pointing to the same object. Then only == operator returns True.



By default .equals() method present in object class is also meant for reference comparison only.



DIfference-3



We can't override == operator for content comparison.



We can override .equals() method for content Comparison .



Difference-4



In the case of heterogeneous type objects == operator causes compile time error saying Incomparable types.



In the case of heterogeneous type object .equals method simply return false and we won't get any compile time or runtime error.





Difference-5



for any object Object reference r, r==null is always false.



for any object reference r, r.equals(null) is always false.



Question 3: What is Clone() method and Its type with differences ?



Answer :



a) The process of creating exactly duplicate objects is called cloning.

b) The main adjective of cloning is to maintain backup ,

c) we can get cloned object by using clone() method of object class.

d) We can call clone() only on cloneable objects

e) An object is said to cloneable . If the corresponding class implements cloneable interface. cloneable interface presently java.lang package and doesn't contain any methods. It is a marker interface.



Its two types : Deep cloning and shallow cloning .



Difference of Deep cloning and shallow cloning



The process of creating just duplicate reference variable , but not duplicate object is called shallow cloning.



The process of creating exactly duplicate independent objects is by default consider as deep cloning.



Example :



Test t1 = new Test();

Test t2 = t1; // Shallow cloning

Test t3 = (Test)t1.clone(); //deep cloning

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «java.lang package Interview Question and Answer part-1», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.