*** CORRECTION: on 1:20 of the video, it incorrectly states that String foo = "foo" is equivalent to:
String foo = new String("foo")
... this is not really true. In fact, it's also misleading to say that Strings are stored in the heap - they are actually stored in a specific place in the heap: "The String Pool". The 'new' keyword will create an object in the heap that references the string in the pool (or create one if it doesn't already exist). Creating a string without using the 'new' keyword will NOT create an additional string object in the heap; it will simply point to the string in the string pool or add it to the pool if it doesn't already exist. This is why "foo" == "foo" will be true (both point to the same string in the pool) and new String("foo") == "foo" will be false (the left part of the expression references an object in the heap, which then references the string in the pool BUT '==' checks for reference, NOT for value). ***
NOTE: a stack is a linear data structure with a particular order in which the operations are performed: first-in, last-out. Also, elements in the stack are encapsulated in frames. To learn more about the role of frames in the stack : https://stackoverflow.com/questions/1...
Auf dieser Seite können Sie das Online-Video REFERENCE vs VALUE TYPES - JAVA mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer The Sukhdev 31 Januar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 100 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!