Let's Understand famous Java interview Questions | Comparable vs Comparator with Example

Поділитися
Вставка
  • Опубліковано 10 гру 2024

КОМЕНТАРІ • 115

  • @kshitijbansal3672
    @kshitijbansal3672 2 роки тому

    Sir, bhut sare videos dkehle iske, pr apne jo explain kia hai, vaisa clear duniya mai koi ni kr sakta...hath jod kr thanks apko

  • @vedpandey2951
    @vedpandey2951 2 роки тому +34

    Yes please make a series of Java interview questions with answer.

  • @share_analysis
    @share_analysis 2 роки тому +3

    Finally ,I understand the detail concept of Comparator & Comparable. thankyou so much sir.

  • @sachinmankotia2291
    @sachinmankotia2291 2 роки тому +11

    Most appropriate answer when to use Comparable and when to use Comparator is :
    If object class (on which you want to do sorting ex : Emp.java is this video) is in your control, then you can use Comparable.
    If object class is not in your control, means you are using some 3rd party API to get data, or you are some library, it means you cant modify code of that object class, the you can use Comparator interface.

  • @shahabu.developer
    @shahabu.developer 10 місяців тому +1

    mast laga sir apka teaching style aur samjhane ka tarika thank You Sir

  • @mayankshrivastava9046
    @mayankshrivastava9046 2 роки тому +1

    yes yes, Yes please make a series of Java interview questions with answer.

  • @yaqubfarooqui8431
    @yaqubfarooqui8431 9 місяців тому

    Most wanted channel learnWithDurgesh in social media.

  • @Anonymous-14567-o
    @Anonymous-14567-o 2 роки тому +9

    Thank you sir may God make your channel of 1 million subscribers because youtube tutors like you tech us that things that we can never learn by paying Thanks again❤️

  • @mindbehaviour9195
    @mindbehaviour9195 2 роки тому

    Durgesh bhai is GOAT❤️💖💕

  • @ashishkumarsrivastav9106
    @ashishkumarsrivastav9106 Рік тому +1

    Great learning

  • @crackit5472
    @crackit5472 2 роки тому +1

    Yes sir we need a series of interviews for java

  • @ajeetchouksey1167
    @ajeetchouksey1167 2 роки тому

    Best Ever video, easy explanation
    No one gives this in depth insight in simple language, Thanks @LearnWithDurgesh

  • @shivampathak1405
    @shivampathak1405 Рік тому

    east or west Durgesh bhaiya is the best

  • @vikas_roy_v1
    @vikas_roy_v1 2 роки тому +3

    I had been asked also this question, Make a video on 'serialization' also sir this is also very frequent asked question in interview

  • @pranshu_bisht
    @pranshu_bisht 2 роки тому

    Sir u r incredible😊 Thanks for clearing my concepts

  • @miteshbarnwal8239
    @miteshbarnwal8239 Рік тому

    You explain difficult concepts in a very simple way

  • @YogeshPatil-xs4sw
    @YogeshPatil-xs4sw Рік тому

    @Thank you Durgesh, it is an excellent explanation of Comparator and Comparable, please add steam of Comparator and if possible Comparable

  • @RahulPatel-uh6zk
    @RahulPatel-uh6zk 2 роки тому

    Very helpful video 🙏🙏🙏🙏🙏❤️❤️❤️❤️❤️❤️❤️

  • @abhishekpawar114
    @abhishekpawar114 2 роки тому +1

    Sir we want these type of example more Please do sir....

  • @simnaniabbasi5866
    @simnaniabbasi5866 2 місяці тому

    Confusion Cleared😇

  • @pahadsingh3709
    @pahadsingh3709 Рік тому

    Ha sir ji ese video chahiye

  • @payalpanjwani5332
    @payalpanjwani5332 2 роки тому

    Thankyou so much! Very well explained. ✌

  • @raghavgupta6446
    @raghavgupta6446 2 роки тому

    Thanks a lot for clearing this confusion

  • @WorldOfMotivation09
    @WorldOfMotivation09 5 місяців тому

    Amazing explanation

  • @photo_lab4095
    @photo_lab4095 2 роки тому

    very helpful for interview point of view

  • @ketank6864
    @ketank6864 Рік тому

    Amazing❤❤❤❤❤❤

  • @anshgandhi5757
    @anshgandhi5757 8 місяців тому

    Thank you so much bhai
    I had doubts regarding this one since long time
    really helpful

  • @debiprasaddash654
    @debiprasaddash654 2 роки тому

    Yes sir please make a interview series

  • @gayatrimungarwadi2477
    @gayatrimungarwadi2477 4 місяці тому

    Very nice...

  • @riyamaji8350
    @riyamaji8350 8 місяців тому

    So clearly explained

  • @aakashdetwal4866
    @aakashdetwal4866 2 роки тому

    very nice explanation

  • @misalmncomps
    @misalmncomps 2 роки тому

    yes sir makes the interview questions...

  • @saritaprasad4295
    @saritaprasad4295 2 роки тому

    You are great Sir!!!!

  • @ganavin3423
    @ganavin3423 5 місяців тому

    great video. thanks .

  • @priyankabachhav5315
    @priyankabachhav5315 2 роки тому

    Thank you so muchhh sir, for this informative concept.. I was too confused in between comparable and comparator and watching videos on UA-cam makes more confusion in my mind.. Like where to implement comparable when to call, how to print by using StringTo, exact difference between comparable n comparator.. Now I am clear with everything like from basic.. Bus mujhe voh (o1.marks - o2.marks); kaise run hota samjha naii I mean kaise compare hota kon chota kon bada n running process samjhi nai.. Baki sab clear

    • @sabkaBaap007
      @sabkaBaap007 Рік тому +1

      When - value is returned then it means the object 2 is greater than the object 1 and when + value is returned then it means the object 1 is greater than object 2, there is nothing more than that in it.

    • @sabkaBaap007
      @sabkaBaap007 Рік тому

      It's common sense, I mean if you subtract two values and you get negative results then it is obvious that the value one was smaller otherwise why would you have gotten a negative value as the result?

  • @priyankavishwakarma4266
    @priyankavishwakarma4266 4 місяці тому

    Thank u ,it was easy to understand by your explanation.

  • @soumyadebbasu7882
    @soumyadebbasu7882 2 роки тому

    Thanks Sir. Please provide more of such interview videos!

  • @mdshadabalam6453
    @mdshadabalam6453 2 роки тому

    Good one.

  • @Neha-il3xi
    @Neha-il3xi 8 місяців тому

    Thanks sir😍

  • @shreyasvaghasia7175
    @shreyasvaghasia7175 2 роки тому

    wow, so well explained , make videos in all imp topics sir pls

  • @Jk-tr1fb
    @Jk-tr1fb 2 роки тому +1

    Sir, I have faced this topic in my last interview

  • @kiranthakur5046
    @kiranthakur5046 6 місяців тому

    Thanks bro😊

  • @All_In_786
    @All_In_786 2 роки тому +2

    I tried in the interview, the interviewer gave me conceptuals questions and i was not selected...
    Thank you Durgesh Bhaijaan for providing such types of videos

  • @RandomClicksBy
    @RandomClicksBy 2 роки тому

    Sir plz continue this series

  • @rohitsingh2k
    @rohitsingh2k 2 роки тому

    please make more such videos bhaiya thank you.👦🏻

  • @nileshgitte9279
    @nileshgitte9279 2 роки тому

    Its very important for interview session please make some video on interview

  • @kumarinidhi90
    @kumarinidhi90 2 роки тому

    Thanks a lot sir.. Nicely explained.... Please make a playlist of java interview questions.

  • @sagarghodekar5745
    @sagarghodekar5745 2 роки тому +1

    Sirji plz make video on how treemap works internally. Java

  • @shaifalisrivastava951
    @shaifalisrivastava951 Рік тому

    Please make the videos on Comparator and Comparable..

  • @faizanabbas839
    @faizanabbas839 2 роки тому

    We can also say comparable use for default natural sorting order and comparator for custumomized

  • @purushottamshisode3661
    @purushottamshisode3661 2 роки тому

    great make series on this

  • @tejasvinikalpande6715
    @tejasvinikalpande6715 2 роки тому

    Thanku so much for video ,it really helpfull
    Plz make video on java interview question

  • @swapniljagatap3533
    @swapniljagatap3533 Рік тому

    Thank you so much

  • @palakgupta2959
    @palakgupta2959 2 роки тому +3

    Sir can you please make this video using java 8... most of the interviewers ask this nowadays how to use comparator, comparable using java 8

    • @sabkaBaap007
      @sabkaBaap007 Рік тому +1

      By using Java 8 all you want is to have lamba functions for overriding the functions of this comparable and comparator function interface.
      Else there is no difference.
      Lamba functions are pretty easy to understand.

  • @Iimran786
    @Iimran786 Рік тому

    What is mean by current object and Emp Obj in this compare To method ,you can focus on this by taking example ...sir

  • @CompIT0597
    @CompIT0597 2 роки тому

    Thank you sir

  • @dipankargarai2727
    @dipankargarai2727 2 роки тому

    Thank you sir 😊

  • @avinashsahu8057
    @avinashsahu8057 Рік тому

    Please make a series of java interview questions

  • @kumardebyashish8295
    @kumardebyashish8295 2 роки тому

    we need a series of interviews for java . please make a series

  • @indrajeetjyoti9020
    @indrajeetjyoti9020 2 роки тому +1

    make videos on on concurrent multithreding like executor framework and java 11 features

  • @sandeepnalawade6886
    @sandeepnalawade6886 Рік тому

    Please make video on String vs String buffer vs String builder with example.

  • @mdumarreza3072
    @mdumarreza3072 2 роки тому

    Thank you so much sir

  • @dhiranshukeswani8822
    @dhiranshukeswani8822 Рік тому +1

    Hi Durgesh
    Thanks a lot for the valuable content you share,
    Could you please make one video on concurrent hashmap + locking mechanism

  • @tonmoykhan5737
    @tonmoykhan5737 2 роки тому

    Thank you

  • @teluram8760
    @teluram8760 2 роки тому

    Yes Sir Please make some releted vdo

  • @AshishSingh-rx4sq
    @AshishSingh-rx4sq 2 роки тому

    Great

  • @AnilPatel-ox1jw
    @AnilPatel-ox1jw 2 роки тому

    Spring security par topic wise video bana sakte hai kya

  • @ajeetchouksey1167
    @ajeetchouksey1167 2 роки тому

    Please make java interview questions series

  • @borntocode555
    @borntocode555 Рік тому

    Love diz vdeoo

  • @HaiderAli-xy9wb
    @HaiderAli-xy9wb Рік тому

    Please also make video on hibernate,Spring Boot, microservices interview question and answers

  • @java8992
    @java8992 2 роки тому

    Sir logical question kaisa puchha jaata hai ...uska v video upload kariyega naa aap

  • @udaypatil7195
    @udaypatil7195 2 роки тому

    Sir Please make the series of interview questions

  • @SandeepKumar-so2st
    @SandeepKumar-so2st 2 роки тому

    Continue sir

  • @mursalimansari1558
    @mursalimansari1558 2 роки тому

    Sir please make video on hashcode and equals internal implementation

  • @bhuvneshkumarsharma7671
    @bhuvneshkumarsharma7671 2 роки тому

    thanks sir

  • @rohanpatel3115
    @rohanpatel3115 2 роки тому

    hello bro what should i learn for java gui for android , do we have to design like html and css through code ? i have seen video where they just have select the view like button etc.

  • @palashpullarwar2581
    @palashpullarwar2581 2 роки тому

    Bhai ""serializable"" concept pe video bana do please... Asaan bhasha me.

  • @vivekbhore5722
    @vivekbhore5722 2 роки тому

    THANK U SIR

  • @ghosh9390
    @ghosh9390 2 роки тому

    Plz series of interview questions

  • @TheChi100
    @TheChi100 2 роки тому

    If there is another list inside the emp object. Then how we will compare it.

  • @navneettripathi2110
    @navneettripathi2110 2 роки тому

    Have seen many comparable and comparator videos. M sure this is best. But u could have included the reverse sorting or multiple sorting ways also.

  • @shrishailmadari8792
    @shrishailmadari8792 12 днів тому

    short short bolraheho bhaiiiii,,, kya yaar, its simple sort,,,i was confused kie wt shoort 🤔🤔,, but thank you bhai,,,

  • @yatendra__singh
    @yatendra__singh 2 роки тому

    Bhaiya ,pls Java interview series for the experience

  • @nivesharyal70
    @nivesharyal70 2 роки тому

    How to sort string in comparable and long in comparator?

  • @mayankkhajure3398
    @mayankkhajure3398 2 роки тому

    Please make one more project on java using servlet and jsp

  • @elfish_aru
    @elfish_aru 2 роки тому

    can you please make a series on kafka

  • @umeshtiwari3057
    @umeshtiwari3057 2 роки тому

    Please explain compareTo and comparator with one more example.

  • @sudhanshukumar8404
    @sudhanshukumar8404 2 роки тому

    one video for equals and hashcode also..

  • @Rohit-dj2lm
    @Rohit-dj2lm 2 роки тому

    Sir how to fix this problem" communication link failure " in eclipse

  • @neeleshmohanty7380
    @neeleshmohanty7380 2 роки тому

    Please make series

  • @suchetapawar7540
    @suchetapawar7540 2 роки тому

    Can we compare multiple fields in one call, something like collection.sort(emps , new IdCompare , new name Compare)
    Is there any alternative way to compare multiple fields in one call?

    • @sabkaBaap007
      @sabkaBaap007 Рік тому +2

      There's no point in comparing multiple fields, just think about that, at any given time you'll have to use one field only if you want to sort. For example how can you sort something by both name and id?
      Either you'd want that to be sorted by name or by id.

  • @yashjadhav6157
    @yashjadhav6157 2 роки тому

    Bro can you tell me how we use this methods in quiz. Means if i want to prepare a mcq type quiz how should we apply these methods to compare options to answer and this is how we get marks as well.. so can you please make video on this please ?

  • @Vikas-yo3jj
    @Vikas-yo3jj 2 роки тому

    Please make video on java project in intellij idea please bro

  • @asifahmed4313
    @asifahmed4313 Рік тому

    please make a video on singleton class

  • @vishalsonwane4374
    @vishalsonwane4374 2 роки тому

    How can I connect with you?

  • @VishalSingh-uw4ne
    @VishalSingh-uw4ne 2 роки тому

    Supb

  • @swastinsahoo2397
    @swastinsahoo2397 2 роки тому

    Class main apna khuda ka custom sort karna hoga toh apko compareable ko implement karna padega .

  • @sanjeevpandit7305
    @sanjeevpandit7305 Рік тому

    Comparator with name sorting is not working

  • @syedfaizan5841
    @syedfaizan5841 9 місяців тому

    ❤❤❤

  • @baibhavkumar4743
    @baibhavkumar4743 2 роки тому

    Bhai interview video banóo