Nice book written by Cay Horstmann.
I wanted to share few quotations from the next two (7-8) chapters.
1) An array is a sequence of values of the same type.
2) You access array elements with an integer index, using the notation a[i].
3) Index values of an array range from 0 to length - 1. Accessing a nonexistent element results in a bounds error.
4) Use the length field to find the number of elements in an array.
5) The ArrayList class manages a sequence of objects.
6) The ArrayList class is a generic class: ArrayList
7) To treat primitive type values as objects, you must use wrapper classes.
8) There are wrapper classes for all eight primitive types:
| Primitive Type | Wrapper Class |
|---|---|
| byte | Byte |
| boolean | Boolean |
| char | Character |
| double | Double |
| float | Float |
| int | Integer |
| long | Long |
| short | Short |
9) Starting with Java version 5.0, conversion between primitive types and the corresponding wrapper classes is automatic. This process is called auto-boxing (even though auto-wrapping would have been more consistent).
10) The enhanced for loop traverses all elements of a collection.
11) To count values in an array list, check all elements and count the matches until you reach the end of the array list.
12) To find a value in an array list, check all elements until you have found a match.
13) An array variable stores a reference to the array. Copying the variable yields a second reference to the same array.
14) Use the clone method to copy the elements of an array.
15) Use the System.arraycopy method to copy elements from one array to another.
16) A test suite is a set of tests for repeated testing.
17) Regression testing involves repeating previously run tests to ensure that known failures of prior versions do not appear in new versions of the software.
18) A class should represent a single concept from the problem domain, such as business, science, or mathematics.
19) The public interface of a class is cohesive if all of its features are related to the concept that the class represents.
20) A class depends on another class if it uses objects of that class.
21) An immutable class has no mutator methods.
22) A side effect of a method is any externally observable data modification.
23) You should minimize side effects that go beyond modification of the implicit parameter.
24) In Java, a method can change the state of an object reference parameter, but it cannot replace the object reference with another.
25) A precondition is a requirement that the caller of a method must meet. If a method is called in violation of a precondition, the method is not responsible for computing the correct result.
26) An assertion is a logical condition in a program that you believe to be true.
27) A static method is not invoked on an object.
28) A static field belongs to the class, not to any object of the class.
29) The scope of a variable is the region of a program in which the variable can be accessed.
30) The scope of a local variable cannot contain the definition of another variable with the same name.
31) A qualified name is prefixed by its class name or by an object reference, such as Math.sqrt or other.balance.
32) An unqualified instance field or method name refers to the this parameter.
33) A package is a set of related classes.
About the Author
Cay Horstmann grew up in Northern Germany and attended the Christian-Albrechts-Universität in Kiel,a harbor town at the Baltic sea. I received a M.S. in computer science from Syracuse University , and a Ph.D. in mathematics from the University of Michigan in Ann Arbor. I now teach computer science at San Jose State University . In my copious spare time I write books and articles on Java and consult on internet programming.
No comments:
Post a Comment