thanks for clarifying singleton class. you are a genius. Respect!!! nobody explained it like you did here
@gauravnagar37127 жыл бұрын
+ Misu ZAMAN true totally agree with you
@LabDutta6 жыл бұрын
agree with u
@shaistakhalid77615 жыл бұрын
Firstly, it was hard for me to understand the concept of Singleton pattern even after watching 4-5 videos, but your one video was more clear and was able to understand within few minutes. Thanks for the good stuff!
@rjlifeandtech86755 жыл бұрын
Nice explanation. Here I found that, Inside Abc class, "static Abc obj = new Abc();" is defaulted to a public statement, so, inside the main method, java will allow accessing directly static obj object. eg. "Abc obj1 = Abc.obj;", so getInstance() method is never needed to use. To fix this, we can mention like "private static Abc obj = new Abc();" and getInstance() method can be used now.
@gouthamrajesh27455 ай бұрын
Thanks 😇
@khalidben99407 жыл бұрын
It would so good if you gave it with a real life example.Syntax is easy to learn but the implementation in programming daily life problems is so important here. But the video and the explanation is amazing.
@jordirex77112 жыл бұрын
for example a class for the connection to the database
@gandamraviteja70192 жыл бұрын
That;s the reason i love navin reddy tutorials he will just make viewers master in the concept what he is teaching Great man u are really great ALIEN..
@drunkmadala2 жыл бұрын
Thanks, I wish I came straight to this post before searching around; you made this concept very easy to understand.
@luyandantabeni25133 жыл бұрын
this is the most simple explanation of a singleton design pattern i ever came across, thanks a lot
@shubhamchopra55186 жыл бұрын
I have completed the playlist, and this is the best explanation i have seen on singleton design pattern! Thanks a lot Naveen
@jonuriah52743 жыл бұрын
A trick: watch series on Flixzone. I've been using them for watching lots of of movies lately.
@merricklawrence67933 жыл бұрын
@Jon Uriah yea, have been using flixzone for months myself =)
@eihodge4 жыл бұрын
Thanks man! I have to make one of these for a project I'm working on. This is exactly what I needed to see.
@buildappswithevan2 жыл бұрын
Great video. Short and to the point. Good explanations.
@youyoudada22507 жыл бұрын
Concise, straight to the point. Thanks for sharing your knowledge
@nitinsinging32045 жыл бұрын
Well done mate, amazingly you have explained this in just 5 mins for which I was seeing more than 20 mins videos. Good job 👍
@TheRaj78raj8 жыл бұрын
simple and easy explanation...thank you so much sir for clearing my concept.
@dayanandswami81092 жыл бұрын
Very nice explanation sir. Keep making this type of valuable video always. Thanks a lot
@aparnaraj33423 жыл бұрын
Best explanation have ever found... thank you:)
@priyeshbhagat10045 жыл бұрын
Happy Teachers Day Sir. Learnt a lot from your videos. Thank you for sharing knowledge :)
@derryyeh2 жыл бұрын
Thanks. This is amazing explanation. Easy to understand!
@richardwilkins52412 жыл бұрын
Great explanation
@abvy252 жыл бұрын
Concise as always!
@VirajMavani3 жыл бұрын
I agree with some of the comments here. The explanation is really good but an example would have helped a lot. One example for Singleton use is simply Database connections. You don't want more than one instance throughout the application.
@dollytiwari97072 жыл бұрын
you are amazing sir.
@jithinmv65164 жыл бұрын
That was a perfect explanation. Thank you❤️
@ankush93862 жыл бұрын
Thank you. Guys please like and share his videos. He really works hard. Thank you sir thank you so much.
@samartajshaikh2601 Жыл бұрын
Thanks for explaining this topic so simply.
@shaileshrkumar68133 жыл бұрын
great video
@rajatvarshney27214 жыл бұрын
clear cut to the point explanation
@AshutoshKumar-kq9vh5 жыл бұрын
Thanks! The explanation was precise and easy to understand.
@bobybrahmam8653 Жыл бұрын
We can also remove the getInstace method and can directly call the object by writing (Abc obj1 = Abc.obj) in main method
@chathuramahasen4 жыл бұрын
Thanks, sir. This really helps to get a proper understanding of the basics!
@danielendless3 жыл бұрын
Best explanation of this. Saved me a whole lot of trouble and inefficient alternatives
@harshverm7766 ай бұрын
*Thanks for the playlist !!!*
@saifsms913 жыл бұрын
Nice Explanation of Singleton :)
@ayushbagwari34965 жыл бұрын
You make everything easy.Thanks keep it up
@_HarshitSharma2 жыл бұрын
Simple and Amazing explanation!
@SasiKumarsachin128 жыл бұрын
very nice tutorial...i can easily understand with your explanation...thanks lot..now am prepare for interview this is very useful for me...thanks once again
@krishnakumarramachandran58884 жыл бұрын
Thanks for the clear Explanation of Singleton.
@poshettiakhil26644 жыл бұрын
Awesome explaination of single ton pattern
@MUSTAFA25719928 жыл бұрын
Thank you, your explanation is very easy to get
@onerifat2 жыл бұрын
nice and clear explanation
@nisithmondal70264 жыл бұрын
best explanation about Singleton Class
@Jolopy80005 жыл бұрын
Top tier video on singleton right here! Awesome job
@DineshKumar-tn7pu3 жыл бұрын
I have a question. We could have called the static variable in the other class main method, would have acted the same way as it is a static variable itself. Why we need a static method and call the static variable through the method?
@amranhossain70996 жыл бұрын
You are a genius , Why don't you make tutorial on every design pattern???????????
@satya121prakash3 жыл бұрын
Today I was asked this question in Java Back End Developer interview for Qualitest.
@ghanshyamb4 жыл бұрын
You are great style to explain problem scenario. On sidenote, let's keep class variable private.
@codethrusharing89552 жыл бұрын
excellent tutorial, thank you so much, easy to understand!
@janta423 жыл бұрын
Thanks Naveen! for making java interesting
@mrwhite41376 жыл бұрын
So clear Thank you
@utilbook78814 жыл бұрын
very good explanation. way to go Telusko
@MuazAtik2 жыл бұрын
Amazing 🙏🙏🙏
@aratibugade58456 жыл бұрын
Very nice explination...easy and simple...
@mannmerwana476 Жыл бұрын
I awe you respect Sir,Can't thank you enough.🙏🏻 I never understood why do we use a private constructor in a singleton class ,when jvm has automatically a default public constructor defined. Got the answer,: To make it private and not allow clients to make objs with default constructor which is public by default,i.e to simple restrict the user from creating instance of the class . Greatful to you.🙏🏻🫡🙏🏻❣️💯
@johnyhawkahsan6 жыл бұрын
Great explanation! Thank you so much.
@iamsubhadas4 жыл бұрын
Excellent tutorial. Thank you, sir.
@mariusailisoaie1837 жыл бұрын
Great tutorial! Thank you for your help. I have a question: if we print the hash code of the obj1 and obj2 we get the same code twice. Why is that ? Should it not be only one hash code?
@bablugope27057 жыл бұрын
if you are getting different hashCode means your class is not singleton class.
@natalievajdova5 жыл бұрын
Thanks, now I understand what Singleton is :-))
@tseponkalai65287 жыл бұрын
wow, only 4 minutes to explain something i have dreaded for the past year!
@priyaj52833 жыл бұрын
Thankyou for thIs beautiful explanation.. could you also includes the implementation of such concepts in a project
@LifeIsGood19925 жыл бұрын
clear and concise !! thanks you
@samomamour85312 жыл бұрын
Thank you a lot 💫
@kostarev20004 жыл бұрын
The best explanation, thank you.
@abdifatahmohamed86004 жыл бұрын
Thanks... that was straight forward!
@speedbumphu6 жыл бұрын
Great explanation of the implementation.
@sarathbaiju60403 жыл бұрын
i have a doubt, every time calling the getInstance() there is new instance of Abc class will create, so then how this approach follows singleton design pattern?
@vamsik36934 ай бұрын
in terms of automation can we implement singleton for creating driver instance where single driver instance can be used through out automation ?
@channelname83004 жыл бұрын
ossssam clarifying man
@gajendraambewadkar77816 ай бұрын
Nice, Thanks
@souravsantra47318 жыл бұрын
thnx man.. Net & clean explanation .
@igorbarros33085 жыл бұрын
congratulations!! great video
@vareshtuli6 жыл бұрын
It is showing an error on class object "The field obj cannot be declared static in a non-static inner type, unless initialized with a constant expression" so make the class also static. Please let me know why it is so?
@ChrisSch2586 жыл бұрын
damn, thank you! short explanation and easy to understand now :)
@oguzaktas72776 жыл бұрын
Thanks good explanation.
@thisismm19074 жыл бұрын
why cant we use Abc.obj instead of Abc.getInstance()..? why should we create the getInstance() method? we can directly write : Abc obj1= Abc.obj; in main method.. please reply sir
@DineshKumar-tn7pu3 жыл бұрын
That was my question too. It would have done the same thing.
@jayanthv58672 жыл бұрын
yeah.. same doubt.. may be he could have declared it as private static obj
@TarekFaham Жыл бұрын
And, if the singleton needs to call a web service to fetch some values, where do you place the code? Do you place it inside the singleton class or outside?
@shashgo6 жыл бұрын
navin, I am writing a web service using rest. How do I use the singleton pattern to create a list that will keep getting updated with new elements with every @POST? The problem is that if I use a regular constructor, then whenever the rest service calls that class using a @POST , a new instance of that class is created with the same elements as before, and so the new element added by the previous @POST request to that class does not persist. Now obviously, I can overcome this limitation by updating the date into a table, but is there a way to do this without using a table?
@ousamaelidrissi58866 жыл бұрын
Thank you very much
@asishsahu81866 жыл бұрын
i think this singleton class is not working in multi threaded environment and we the static variable is always loads at the time of loading the class so the object is stored in jvm memory if we dont use also the jvm memory will be waste
@NXNAWAFXN5 жыл бұрын
Thanks brother
@dannyyu42276 жыл бұрын
thank! so simple
@arifahmed78554 жыл бұрын
Boss of JAVA
@prithiviraj67976 жыл бұрын
Thanks bro..
@tsp573 жыл бұрын
Thank you
@ramkumaradimulam34306 жыл бұрын
Is it not the otherway? Meaning, since obj needs to be static (so that its shared among all Abc instances), the getter getInstance() needs to be static.
@thellaidhinesh89295 жыл бұрын
what is the use of the singleton class in Java sir? and at what situation we use singleton ?
@raghuakuthota49005 жыл бұрын
how about clone then, I can clon the existing object and I can create another object as well right?
@k0lbis6 жыл бұрын
thanks this helped so much!
@stefanelse5 жыл бұрын
Awesome, tnx bro,
@manindersingh63713 жыл бұрын
Just adding some information here because I was facing the issue. We can create as many as instances inside the class because in the class we can access private constructor but we can't access it from outside the class.
@response2u7 жыл бұрын
Perfect! TNX
@joejones57465 жыл бұрын
Thanks buddy
@youssh49755 жыл бұрын
Would it make sense to declare such a class as abstract?
@natangurfinkel4 жыл бұрын
Thanks.
@sankarachelliah28722 жыл бұрын
Hey! Is possible to pass arguments in singleton
@NileshKumar-mk2ze6 жыл бұрын
Hello Sir, I have one question If Two threads are accessing the Singleton class object at a same time then what will happen or what problem will come and how we resolve such problem.
@piyush96arora5 жыл бұрын
To solve your concern you could use synchronized keyword
@sagarghare98297 жыл бұрын
Thanks sir!!
@inoxide5454Күн бұрын
Student: Are you Reddy? Navin: Yes i am.
@kleavenae7 жыл бұрын
My way: public final class Singleton { public static final Singleton SINGLETON = new Singleton(); private Singleton() {} } usage: import static Singelton.SINGLETON; SINGLETON.method(); Is there any problem with that?
@nanashipersonne41515 ай бұрын
I know how to make it now, but in what situations is this useful?
@manickam72312 жыл бұрын
Bro y cant we use static class abc Insted of declaring an static abc object
@swapnilsrivastav34779 жыл бұрын
If I use Reflection API then I can call private constructor ... So I wanted to ask if I am using Reflection API it means I can't implement concept of singleton ???