TIJ swot_JAVA的初学者(五)

原创 2004年09月16日 02:32:00

1.7 Object landscapes and lifetimes

Well, mentioned something 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 time required to allocate storage on the heap is significantly longer than the time to create storage on the stack.

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 don't 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 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 them to the user of the iterator.

The container, via iterator, is abstracted 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!

 

 

 

一个程序员的SWOT分析V1.0

对个人的自身情况进行了简单的SWOT分析,总感觉分析不够全面,感觉各个方面分析没有到点子上,感觉少了些什么,希望得到大家的指导和分享:)。   一个程序员的SWOT分析V1.0的文本内容 ...
  • hiswot
  • hiswot
  • 2011-12-06 08:58:05
  • 2237

如何透彻分析Java开发人员

第一部分:对于参加工作一年以内的同学。恭喜你,这个时候,你已经拥有了一份Java的工作。 这个阶段是你成长极快的阶段,而且你可能会经常加班。但是加班不代表你就可以松懈了,永远记得我说的那句话,从你入...
  • bestxiaok
  • bestxiaok
  • 2017-11-01 17:28:33
  • 333

JAVA人生

  • fsg74101
  • fsg74101
  • 2009-09-10 09:16:00
  • 156

TIJ swot_JAVA的初学者(二)

我只是个JAVA的初学者找了本英文书来看。这里主要是一些摘要,帮助自己记忆理解,放到BLOG里只是为了督促自己坚持下去。对于觉得不相干的朋友表示道歉:)如果大家有更好的学习方法,请赐教!非常感谢:)1...
  • Miracle04
  • Miracle04
  • 2004-09-15 06:28:00
  • 758

TIJ swot_JAVA的初学者(四)

1.4 Reusing the implementationWe could reuse a class by instantiate it as an obect or place an objec...
  • Miracle04
  • Miracle04
  • 2004-09-16 00:56:00
  • 867

IT开发工程师的悲哀

转载至天涯上的一篇文章, 不知大家看后有什么感想?希望大家发表意见,相互学习学习,特别是前辈们! 恭喜,你选择开发工程师做为自已的职业!悲哀,你选择开发工程师做为自已的职业!    本文所指的开发工程...
  • maliang1225
  • maliang1225
  • 2007-07-08 17:30:00
  • 505

人生

人生,就像是一个很大的栈演变。出生时你赤条条地来到人世,慢慢地长大,渐渐地变老,最终还得赤条条地离开世间。     人生,又仿佛是一天一天小小的栈重现。童年父母抱你不断地进出家门,壮年你每天奔波于家...
  • q673327335
  • q673327335
  • 2013-01-17 09:52:23
  • 242

TIJ swot_JAVA的初学者(六)

1.8 Exception handling: dealing with errorsAn exception is an object thrown from the site of the err...
  • Miracle04
  • Miracle04
  • 2004-09-16 04:27:00
  • 714

TIJ swot_JAVA的初学者(一)

我只是个JAVA的初学者找了本英文书来看。这里主要是一些摘要,帮助自己记忆理解,放到BLOG里只是为了督促自己坚持下去。对于觉得不相干的朋友表示道歉:)如果大家有更好的学习方法,请赐教!非常感谢:)S...
  • Miracle04
  • Miracle04
  • 2004-09-15 05:36:00
  • 874

人生日志

25年前的今天,我来到这个世界上,开始了我人生的旅程.今天是俺25岁的第一天,今天是周五,早上起来上班,好像也没有什么特殊的事情发生,下班后打算回家,回家看看我的亲人,我的父母,25年前的今天他们正因...
  • van150
  • van150
  • 2006-04-07 09:23:00
  • 916
收藏助手
不良信息举报
您举报文章:TIJ swot_JAVA的初学者(五)
举报原因:
原因补充:

(最多只允许输入30个字)