Today i started reading Java Concepts 5th Edition By Cay Horstmann.
Nice book written by Cay Horstmann.
I wanted to share few quotations from the next two (3-4) chapters.
1) A method definition contains an access specifier (usually public), a return type,a method name, parameters, and the method body.
2) Constructors contain instructions to initialize objects. The constructor name is always the same as the class name.
3) Provide documentation comments for every class, every method, every parameter, and every return value.
4) An object uses instance fields to store its state—the data that it needs to execute its methods.
5) Each object of a class has its own set of instance fields.
6) We should declare all instance fields as private.
7) Encapsulation is the process of hiding object data and providing methods for data access.
8) The process of hiding the data and providing methods for data access is called encapsulation.
9) Constructors contain instructions to initialize the instance fields of an object.
10) A unit test verifies that a class works correctly in isolation, outside a complete program.
11) To test a class, use an environment for interactive testing, or write a tester class to execute test instructions.
12) Instance fields belong to an object. Parameter variables and local variables belong to a method—they die when the method exits.
13) The second major difference between instance fields and local variables is initialization. You must initialize all local variables. If you don't initialize a local variable, the compiler complains when you try to use it.
Instance fields are initialized to a default value, but you must initialize local variables.
14) The implicit parameter of a method is the object on which the method is invoked. The this reference denotes the implicit parameter.
15) Use of an instance field name in a method denotes the instance field of the implicit parameter.
16) Java has eight primitive types, including four integer types and two floating-point types.
17) Rounding errors occur when an exact conversion between numbers is not possible.
18) A final variable is a constant. Once its value has been set, it cannot be changed.
19) Use named constants to make your programs easier to read and maintain.
20) Assignment to a variable is not the same as mathematical equality.
21) The ++ and -- operators increment and decrement a variable.
22) A static method does not operate on an object.
23) A string is a sequence of characters. Strings are objects of the String class.
24) Strings can be concatenated, that is, put end to end to yield a new longer string. String concatenation is denoted by the + operator.
25) Whenever one of the arguments of the + operator is a string, the other argument is converted to a string.
26) If a string contains the digits of a number, you use the Integer.parseInt or Double.parseDouble method to obtain the number value.
27) Use the substring method to extract a part of a string.
28) String positions are counted starting with 0.
29) Use the Scanner class to read keyboard input in a console window.
30) Java has eight primitive types, including four integer types and two floating point types.
31) A numeric computation overflows if the result falls outside the range for the number type.
32) The ++ and -- operators increment and decrement a variable
33) The Math class contains methods sqrt and pow to compute square roots and powers.
34) Whenever one of the arguments of the + operator is a string, the other argument is converted to a string.
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.
Monday, 27 October 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment