#26 Stack And Heap in Java

Поделиться
HTML-код
  • Опубликовано: 10 окт 2024

Комментарии • 95

  • @arjunthazhath
    @arjunthazhath Год назад +48

    I just love you sir! I was confused for so long about heap and stack. Now its clear! U are a great teacher.

  • @thefriendlymartian7317
    @thefriendlymartian7317 7 месяцев назад +2

    The best explanation anyone could ever give. As soon as I have a question in my mind, you call out that point and explain as if I asked the question in person. Just shows how perfectly the flow of the content is.

  • @kapiljain359
    @kapiljain359 Год назад +8

    Really Nice explained. I am following Telusko since my collage time(2018). And now I am the Senior Software Developer in reputated Product company. Big Thanks Goes to Mr Naveen. Thank you Sir!
    I would like to request if you can make the playlist on AWS for Java Developers. It would be very helpful.

  • @ajiboladaniel9386
    @ajiboladaniel9386 11 месяцев назад +10

    The best Java teacher I've ever encountered in my life. You are awesome sir. The understanding of the concept is sooo seamless. It's like a miracle. Thanks soo much.

  • @mehedishuvo6257
    @mehedishuvo6257 6 месяцев назад +1

    Well explained dear sir.Not only India but also all over the world students get benefited by your lecture,. This is a masterpiece that ever created by you.💜💜💜💜💜,,,,Love from Bangladesh dear sir.

  • @MsSWAGboss
    @MsSWAGboss Год назад +6

    Thank you for the video :) I just started going into interviews again and this helped me get back to speed on the topic cause I had forgotten so much stuff throughout the year as a junior dev

  • @piotr2951
    @piotr2951 5 месяцев назад +21

    No, we don't have multiple stacks (in a single thread), those are called frames. Those frames contain multiple data structures for storing local variables, operands, return addresses, constants.

    • @GDuraimuruganCSE
      @GDuraimuruganCSE Месяц назад

      😂

    • @khadeejahannah
      @khadeejahannah 25 дней назад +1

      Yes.. every method doesn't hav its own stack!
      Stack frames are created for each method call n removed once the method completes

    • @ankitmeshram8461
      @ankitmeshram8461 4 дня назад

      A Request - It would be helpful for new learners If you could tag a link to the video or the document that contains right & complete information of this particular topic!

  • @danurarya0823
    @danurarya0823 Год назад +3

    Thanks for this sir, i like when you are describing how things work using a sketch.
    maybe it's just me but reading documentation that just only have text explanation is really confusing and to imagining it was really hard.

  • @abbaszandi7481
    @abbaszandi7481 Месяц назад

    you explain everything clearly and perfect. thanks for sharing your precious knowledge.

  • @MohdZaid-kv7yn
    @MohdZaid-kv7yn Год назад +10

    Watching 2 hours before java developer interview

    • @CSSHANUSG
      @CSSHANUSG 2 месяца назад

      How was the interview, brother

    • @MohdZaid-kv7yn
      @MohdZaid-kv7yn 2 месяца назад +2

      @@CSSHANUSG cracked it but they didn’t ask me stack and heap ;)

    • @CSSHANUSG
      @CSSHANUSG 2 месяца назад +1

      @@MohdZaid-kv7yn that's great....🔥 thanks brother

  • @bharathsajan8926
    @bharathsajan8926 4 месяца назад +2

    wonderfully explained thank you.

  • @WorstinJava
    @WorstinJava 8 месяцев назад +1

    I became a diehard fan for you sir ❤ love you and love your teachings sir

    • @WorstinJava
      @WorstinJava 8 месяцев назад

      Thank You SIR ✨
      This is my status today 🫴 ✨
      Thank You SIR 💫

  • @ajuSiuuu
    @ajuSiuuu 2 месяца назад +1

    100 times better than those paid courses

  • @congdatt
    @congdatt 6 месяцев назад +1

    Stack:
    - Store local variables
    - Address of obj ( obj store in HEAP )
    Heap:
    - Store obj. Have 2 sections: instance variables & .... (add(),....)
    Every method have own stack

  • @rushikeshbhujbal2480
    @rushikeshbhujbal2480 Год назад +4

    you are really great,this content is really helpfull and thanks for the notes that you are providing in description.

  • @srushtishah8674
    @srushtishah8674 7 месяцев назад

    When i asked my sir about instance variable he gave me such lame ans that I gave up on every being able to understanding it. Thanks!!

  • @princeiiolaguera921
    @princeiiolaguera921 9 месяцев назад

    Best course imo. Can you please create exercises so we can test our knowledge and skills so far? Thank you

  • @Prabhu_0_7
    @Prabhu_0_7 2 месяца назад

    sir give us a quetion bank to practice this concepts, all quetions from basic to advance, so we can practice and implement the concepts or logic. your lectures are very easy to understand!! they are very helpful thank you!!!😃😃😃

  • @HocineFerradj
    @HocineFerradj 2 месяца назад

    U are a great teacher

  • @unemployedcse3514
    @unemployedcse3514 5 месяцев назад

    this channel gives trustworthy content where other's just do for content sake

  • @chairma_prabhu
    @chairma_prabhu Год назад

    Thank you Navin for providing quality content like this.

  • @Coding-Just
    @Coding-Just Год назад

    Navin sir it's totally clear thanks a lot and sir i have to join your Java backend course but Saturday is my college sir and it's 3rd year bca 7 to 12 time is not convenient sir

  • @uchihasenpai5671
    @uchihasenpai5671 Год назад +1

    Shouldn't obj be created after DATA in the stack? I mean should not OBJ be above data?

  • @bahasahli4151
    @bahasahli4151 8 месяцев назад

    Simply awesome thank you 🌼

  • @minote8t451
    @minote8t451 2 месяца назад

    Hi sir , i have a question . We all know that if we wanna create an object we need to use the new keyword for that , if we don't it won't use a different part of memory ! But the question is , so why we can create a copy constructor in a class without using that new keyword and still have a different area of memory which is not gonna effect the main object ?
    I would be glad if you answer me , and thanks for your great teaching skills !

  • @Shubham-si6hd
    @Shubham-si6hd Год назад +1

    You are a life saver! Thank You

  • @valoranthighlights6374
    @valoranthighlights6374 3 месяца назад

    great explanation . love it

  • @moaazsuliman7584
    @moaazsuliman7584 Год назад

    From Egypt Thank You Very Much

  • @sn0wball13
    @sn0wball13 8 месяцев назад

    Thank you so much for this explanation!!!! :)

  • @saumyojitdas4212
    @saumyojitdas4212 Год назад +1

    public class Main
    {
    String s = "ABC";
    public static void main(String[] args) {
    Main obj = new Main() ;
    System.out.println(obj.s);
    }
    }
    in this above code String object is created in heap and also of class.
    So 2 objects in heap.
    But isn't the string object Abc resides inside class object in the heap?that's why we are calling it obj.s

  • @nasamind
    @nasamind 10 месяцев назад

    Simply awesome

  • @srinivasmb-re8km
    @srinivasmb-re8km Год назад +3

    Where static variables are stored?
    static int in = 10;

  • @hdkzmsakao
    @hdkzmsakao 2 месяца назад

    thank you sir

  • @sahinyusifli9756
    @sahinyusifli9756 Год назад

    Thank you, it was so educative to me

  • @anupam6045
    @anupam6045 4 месяца назад

    best explanation sirr

  • @hridikasaha9519
    @hridikasaha9519 Год назад

    Excellent explanation

  • @zr0724
    @zr0724 Год назад +1

    wow , these tutorials are of next level for sure. thank you sir.

  • @ramenmanna6150
    @ramenmanna6150 Год назад

    Great video sir 😊 understand concepts very well ! love you sir 🥳

  • @SirHarshPatel
    @SirHarshPatel 8 месяцев назад

    incredible

  • @rajnishchoubey2246
    @rajnishchoubey2246 Год назад

    Sir with reference to memory allocation in java can u plzz specify which of the variables have static memory allocation and which one has dynamic allocation and why

  • @adora6860
    @adora6860 9 месяцев назад

    maraming salamat tol

  • @ganesang7217
    @ganesang7217 8 месяцев назад

    I understand clearly, it's not an object. It's a reference type.like Car c = new Car() c is reference type, correct or not

  • @afsirlaghari3738
    @afsirlaghari3738 Год назад

    Love you Naveen sir, from Pakistan.

  • @ehteerk
    @ehteerk Год назад

    An instance variable is a variable that is specific to a certain object. It is declared within the curly braces of the class but outside of any method. The value of an instance variable can be changed by any method in the class, but it is not accessible from outside the class

  • @vishnusunil7446
    @vishnusunil7446 Год назад

    Amazing video.. thank you.

  • @jackfrost8969
    @jackfrost8969 Год назад

    excellent video.
    Keep it up.

  • @Avineshutube
    @Avineshutube 4 месяца назад

    excellent !!

  • @marcos_silvestri
    @marcos_silvestri Год назад

    Splendid!

  • @rosaliademartino7265
    @rosaliademartino7265 Год назад

    nice and clear, thanks!

  • @abhishekmb7690
    @abhishekmb7690 Год назад +1

    Where the memory will be allocated for static members and static methods sir

  • @prakash1to7
    @prakash1to7 Год назад

    Great way of delivery Sir. Really motivating to learn. Keep on Rocking Sir :-)

  • @aaaeditzforever
    @aaaeditzforever 11 месяцев назад

    Super

  • @alexkuzmichev9051
    @alexkuzmichev9051 Год назад

    nicely explained! by the way, what program do you use to draw?

  • @FEJAYACHANDRANK
    @FEJAYACHANDRANK Год назад

    I have one doubt what if the class is static ... we cant create instance right at the case how is memory allocated

  • @abhiroy1993
    @abhiroy1993 Год назад

    Will the 'add' method stack be reused for the 2 different objects or will it create a new 'add' method stack for obj1?

    • @Krishna_script
      @Krishna_script Год назад

      the new obj1 will reuse the add method which is there in the stack

    • @saumyojitdas4212
      @saumyojitdas4212 Год назад

      ​@@Krishna_scriptpublic class Main
      {
      String s = "ABC";
      public static void main(String[] args) {
      Main obj = new Main() ;
      System.out.println(obj.s);
      }
      }
      in this above code String object is created in heap and also of class.
      So 2 objects in heap.
      But isn't the string object Abc resides inside class object in the heap?that's why we are calling it obj.s

  • @ahmedyoussef7923
    @ahmedyoussef7923 3 месяца назад

    Java does not have multiple call stacks per thread. Each thread has a single call stack that tracks method invocations and local variables.

  • @shyamchowdary5086
    @shyamchowdary5086 10 месяцев назад

    I have a doubt. When we write a local variable in Java. It automatically allocates memory or it allocates after compilation? Please someone address this.

  • @-RimuruTempest
    @-RimuruTempest Год назад

    Hi, I have one doubt. What about the add method in stack? If we create two objects then the is there two add stack?

  • @rajattalreja9740
    @rajattalreja9740 Год назад

    One question - Exactly when is a stack created? When the method is created of when the method is called?

    • @sachinkhatri1077
      @sachinkhatri1077 Год назад

      I think stack memory allocated at run time. So it created when mehod is called. Thats why we get stackoverflow error at runtime instead of compile time.

    • @banujan.b2479
      @banujan.b2479 8 месяцев назад

      To be more specific the entire program has a stack. But when you call a method, each method creates a stack-frame in the stack.

  • @ummersiddique
    @ummersiddique 3 месяца назад

    Which device is he using for drawing?

  • @partoon863
    @partoon863 Год назад

    If you guide us in Hindi we understand it more clearly

  • @ashutoshraj8668
    @ashutoshraj8668 Год назад +1

    But sir methods of objects are stored in method area😢

  • @actandrepeat
    @actandrepeat Год назад

    Wow!

  • @rohithvishnukumar7969
    @rohithvishnukumar7969 Месяц назад

    I have a dooubt that where are static variables stored

  • @Ounknown098
    @Ounknown098 Год назад

    i am comming from pw skills to watch full memory alliocaion

  • @YuvarajRoll
    @YuvarajRoll 11 месяцев назад

    Sir how to get input from users in java

  • @keinsent
    @keinsent 5 месяцев назад

    tqsmomg

  • @papo7936
    @papo7936 Год назад

    Could you replicate this video for python too?

  • @muthukumarthangapandian8434
    @muthukumarthangapandian8434 Год назад

    both objects having same address only. if car1 =car2
    class Car
    {
    String name;
    int cost;
    double mileage;
    }
    public class PassByReference {
    public static void main(String arg[])
    {
    Car car1 =new Car();
    System.out.println(car1.name);
    System.out.println(car1.cost);
    System.out.println(car1.mileage);
    car1.name="bmw";
    car1.cost=1_00_0000;
    car1.mileage=17.5;
    System.out.println(car1.name);
    System.out.println(car1.cost);
    System.out.println(car1.mileage);
    Car car2=car1;
    System.out.println(car2.name);
    System.out.println(car2.cost);
    System.out.println(car2.mileage);
    car2.name="honda";
    car2.cost=1_00_000;
    car2.mileage=18.5;
    System.out.println(car2.name);
    System.out.println(car2.cost);
    System.out.println(car2.mileage);
    System.out.println(car1.name);
    System.out.println(car1.cost);
    System.out.println(car1.mileage);
    System.out.println( car1.hashCode());
    System.out.println( car2.hashCode());
    System.out.println(car1);
    System.out.println(car2);
    }
    }

  • @mohokhachai
    @mohokhachai Год назад

    Scope

  • @mohokhachai
    @mohokhachai Год назад

    Thier values is null

  • @mohokhachai
    @mohokhachai Год назад

    Entry point

  • @banujan.b2479
    @banujan.b2479 8 месяцев назад

    Each method has own stack or stack-frame? 🙄

  • @JohnHall-s9v
    @JohnHall-s9v 9 дней назад

    3302 Mollie Port

  • @RamSingh-bi9tc
    @RamSingh-bi9tc 3 месяца назад

    But damaging one phone affect the user heart

  • @jatinsharma3792
    @jatinsharma3792 Год назад

    You beauty !!

  • @mohokhachai
    @mohokhachai Год назад

    Thier only one main entry function

  • @navingautam8878
    @navingautam8878 Год назад

    same name haha

  • @abirhore6645
    @abirhore6645 23 дня назад

    bro you just detaching from the topic itself...I just want to know the difference you are way too much describing things

  • @khanhgiapham-mi4hg
    @khanhgiapham-mi4hg Год назад

    please speak English sir

  • @mr.islam777
    @mr.islam777 2 месяца назад

    Your teaching style not so good . Please explain more clearly