Friday, 24 October 2008

Java Concepts By Cay Horstmann - Part1

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 first 2 chapters.

1) At the heart of the computer lies the central processing unit (CPU). It consists of a single chip (integrated circuit) or a small number of chips. A computer chip is a component with a plastic or metal housing, metal connectors, and inside wiring made principally from silicon. For a CPU chip, the inside wiring is enormously complicated. For example, the Pentium 4 chip (a popular CPU for personal computers
at the time of this writing) contains over 50 million structural elements called transistors—the elements that enable electrical signals to control other electrical signals, making automatic computing possible. The CPU locates and executes the program instructions; it carries out arithmetic operations such as addition, subtraction,multiplication, and division; and it fetches data from storage and input/output devices
and sends data back.

2) The computer keeps data and programs in storage. There are two kinds of storage.Primary storage, also called random-access memory (RAM) or simply memory, is fast but expensive; it is made from memory chips. Primary storage has two disadvantages. It is comparatively expensive, and it loses all its data when the power is turned off. Secondary storage, usually a hard disk, provides less expensive storage that persists without electricity. A hard disk consists of rotating platters, which are coated with a magnetic material, and read/write heads, which can detect and change the patterns of varying magnetic flux on the platters. This is essentially the same recording and playback process that is used in audio or video tapes.

3) The CPU, the RAM, and the electronics controlling the hard disk and other devices are interconnected through a set of electrical lines called a bus. Data travel along the bus from the system memory and peripheral devices to the CPU and back.

4) Translating Human-Readable Programs to Machine Code
On the most basic level, computer instructions are extremely primitive. The processor executes machine instructions. CPUs from different vendors, such as the Intel Pentium or the Sun SPARC, have different sets of machine instructions. To enable Java applications to run on multiple CPUs without modification, Java programs contain machine instructions for a so-called "Java virtual machine" (JVM), an idealized CPU that is simulated by a program run on the actual CPU. The difference between actual and virtual machine instructions is not important—all you need to know is that machine instructions are very simple, are encoded as numbers and stored in memory, and can be executed very quickly.

5) Because machine instructions are encoded as numbers, it is difficult to write programs in machine code.

In the mid-1950s, high-level programming languages began to appear. In these languages, the programmer expresses the idea behind the task that needs to be performed, and a special computer program, called a compiler, translates the high-level description into machine instructions for a particular processor.

High-level languages allow you to describe tasks at a higher conceptual level than machine code.

Java is case sensitive. You must be careful about distinguishing between upper- and lowercase letters.

6) A method name is overloaded if a class has more than one method with the same name (but different parameter types).

7) In Java, a variable whose type is a class does not actually hold an object. It merely holds the memory location of an object.

We use the technical term object reference to denote the memory location of an object. When a variable contains the memory location of an object, we say that it refers to an object.Hence An object reference describes the location of an object.

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: