Note of 《thinking in java》2

(2). Everything is an object

  1. String can be initialized with quoted text.
  2. There are six different places to store data: registers, the stack, the heap, static storage, constant storage, non-RAM-storage
  3. You can do everything with a BigInteger or BigDecimal that you can with an int or float.
  4. When you create an array of objects, you are really creating an array of references, and each of those references is automatically initialized to a special value with its own keyword: null.
  5. The variable in local scope can not hide the name of global scope, you'll get compile error.
  6. Java has a garbage collector, which looks at all the objects that were created with new and figures out which ones are not being referenced anymore.
  7. When a primitive datatype is a member of a class, it's guaranteed to get a default value if you do not initialize it.
  8. It's best to always explicitly initialize your variables.
  9. This guarantee doesn't apply to "local" variables --- those that are not fields of a class.
  10. A problem in any programming language is the control of names.
  11. The Java creators want to use your internet domain name in reverse since those are guaranteed to be unique.
  12. Internet domain name mechanism means that all of your files automatically live in their own namespaces.
  13. Whenever you want to use a predefined class in your program, the compilor must know to locate it.
  14. Import tells the compiler to bring in a package, which is a library of classes.
  15. A static method can create or use named objects of its type.
  16. There is a certain library of classes that are automatically brought into every Java file: java.lang.
  17. The name of the class is the same as the name of the file.
  18. One of the better ideas in Java is that writing code isn't the only important activity --- documenting it is at least as important.
  19. Javadoc allows you to create and maintain a single source file and automatically generate useful documentation. Because of javadoc we have a standard for creating documentation.
  20. The javadoc will process comment documentation for only public and protected members.
  21. However, you can use the -private flag to include private members as well.
  22. The output for the preceding code is an HTML file that has the same standard format as all the rest of the Java documentation.
  23. You can also use HTML just as you would in any other Web document to format the regular text in your descriptions.
  24. Don't use headings such as <hl> or <hr> as embedde HTML because javadoc inserts its own headings and you will interere with them.
  25. The @see tag allows you to refer to the documentation in other classes.
  26. Javadoc will not check the hyperlinks you give it to make sure they are valid.
  27. A methord that is marked @deprecated causes the compiler to issue a warning if it is used.
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章