Singleton Design Pattern Java. Early & Lazy Instantiation. Part-1 Bengali-Ep:19 #learnjava #bengal
Hi,
Hope you are all doing great. Let's learn together.
Join Telegram: ? https://t.me/contactajoydebnath
Chapters ❤
0:00 Introduction
01:04 Theory
04:46 Early Instantiation Theory
05:03 Early Instantiation Code Implementation
13:47 Lazy Instantiation Code Implementation
19:58 Lazy Instantiation Theory
Note:
Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, James Gosling and his team changed the name from Oak to Java.
Video Links --
HashSet, Its Methods & How It Works Internally in Java: https://youtu.be/nQOLOBlgw-w
Static Keyword, Static variable, block, method, nested class: https://youtu.be/tgzUgat88_A
Access Modifier. Private, Public, Default, Protected: https://youtu.be/Fkkcc6ypCtw
Core Java Playlist: https://www.youtube.com/playlist?list=PL0LQjbMWLlS3AVp2LglGSvfV6ieUSsNMp
Spring Playlist: https://www.youtube.com/playlist?list=PL0LQjbMWLlS3tXLVZBuLmsMJ9dU6JNtGD
Document Link -
https://docs.google.com/document/d/1O2qQD5huUzhP4DKIqPEAPmQwLeCqxjXYWLJqThdY_Bc/edit?usp=sharing
Like, Comment, Share, and Subscribe.
Thank you again.
STS Link:
https://spring.io/tools
JDK Link:
https://www.oracle.com/java/technologies/downloads/
Singleton design pattern
Sometimes we need to have only one instance of our class.
Definition:
The singleton pattern is a design pattern that restricts the instantiation of a class to one object.
There are two forms of singleton design patterns-
Early Instantiation: the creation of an instance at load time.
Lazy Instantiation: the creation of an instance when required.
How to create a Singleton design pattern?
To create the singleton class, we need to have a static member of the class, a private constructor, and a static factory method.
Static member: It gets memory only once because of static, it contains the instance of the Singleton class.
Private constructor: It will prevent to the instantiation of the Singleton class from outside the class.
Static factory method: This provides the global point of access to the Singleton object and returns the instance to the caller.
Early Instantiation
In such a case, we create the instance of the class at the time of declaring the static data member, so an instance of the class is created at the time of class loading.
Lazy Instantiation:
The first time factoryMethod() is called it creates a new singleton object and after that, it just returns the same object. Note that Singleton obj is not created until we need it and call factoryMethod() method. This is called lazy instantiation. But there is a problem with factoryMethod() method….Will discuss this in the next video.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Singleton Design Pattern Java. Early & Lazy Instantiation. Part-1 Bengali-Ep:19 #learnjava #bengal», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.