In this stack area jvm give the machine code to thread that means entire program so that is where stored and static method executes static area so thread bring to static memorey and execute sir
What did you create the buildChannel method? You can instantiate a new Channel object in the main method with this line: Channel channel = new Channel(id, name);
Thank you so much for the detailed explanation, good tutorial, crystal clear and well explained. Just one question, at 3:02, when the local variable is created in a parent method and that value passed as a parameter to a child method, does that same variable need to be duplicated in the stack memory twice ?
I am so glad I could be of help :) It is not actually duplication, because in the stack you only have a reference to the same instance in the heap. So, there is one instance but two references pointing at it, each reference is encapsulated within the scope of that call in the call stack. Hope this answers it!
Amazing, questions please: 1- @3:04 why Channel reference is created ? There is no local variable Channel, there is only id and name 2- is ‘this’ always created when new operator is used and object created? This is why we can use this in our program? Thank u
Thank you! When an object is created in the Heap Space only a reference to it is created in the Stack Memory, this way the same object can be referenced from multiple sources, and yes a this reference is created for every object. Cheers!
Hello, not sure if I got you correctly, but here: ru-vid.com/group/PLlsmxlJgn1HLQ8WxpuToXlaAcAw1TPlyP you can find all our uploads related to Abstract Data Types and their implementations in Java. Cheers!
Hello! All non-static members (variables and methods) are stored inside their corresponding object memory in the heap because you can only reach them via that object. Hope this answers your question!