Tij SWOT

xiaoxiao2021-03-06  56

1.7 Object Landscapes and Lifetimes

Well, Mentioned Sometting About C

C takes the approach that control of efficiency is the most important issue, so it gives programmer the choice to determine the storage and lifetime while the program is being written, by placing the objects on the stack or in the staic storage area. (What the HELL IS THAT?) But this Approach Obviously Sacrifices The flexibility.

In Java, objects are created dynamically in a pool of memory called the heap. In this approach, we dont know how many objects we need until the run-time. But because the storage is managed dynamically, at run-time, the amount of .

Then, another issue, the lifetime. In a language like C , it must be determined programmatically when to destroy the object, which can lead to memory leaks if you do not do it correctly. Java provides a feature called garbage collector that automatically discovers When An Object Is No longer in Use and destroys it.

1.7.1 Collections and Iterators

In OOP language, we have a set of containers to expand themselves whenever necessary to accomodate everything we place inside it. Such as, in C we have Standard Template Library (STL), Object Pascal has Visual Component Library (VCL). In Java, WE STANDARD LIBRARIES, LIKE Vector, SETS, Queues, Hash Tables, TREES, Stacks, etc.

And, there comes iterator, which is an object as well. Its job is to select the elements within a container and present the user of the iterator.

The Container, Via Iterator, IS Abstract to Be Simply a Sequence.

In Vresion1.0 and 1.1, Java Has Standard Iterator, Called Enummeration. Java2 Has Added a MUch More Complete Library That Contains An Iterator Called Iterator.1.7.2 The Singly Rooted Hierarchy

All classes in java are inherited from class object.

Hoop! What do i know?

SINGLY ROOTED HIERARCHY IS Good for OOP AND Easier TO IMPLEMENT A GARBAGE COLLCTOR. COME Back Later!

转载请注明原文地址:https://www.9cbs.com/read-116521.html

New Post(0)