Classes and objects in Java

Clark S. Lindsey, Johnny S. Tolliver, Thomas Lindblad · Cambridge University Press eBooks · 2005

Introduction In Java the “class” is paramount. Essentially all coding resides within class definitions. Here and in the following chapters we develop the concepts and coding for classes and objects in Java. For those new to object-oriented programming (OOP) the learning curve can be rather steep because several concepts must be understood before the overall picture comes into focus. The Web Course Supplements section for Chapter 3 offers additional introductory material to help get these concepts across. Note that throughout the book we use the terms object and instance interchangeably. Custom data types In Chapter 2 we discussed Java primitive data types such as int, float, and boolean. Data of a given type means that memory is reserved for a value of that type and that only operations specific to that type can act upon the data. So, for example, a float value has 4 bytes of memory allocated for it with the sign, exponent, and significand bits arranged according to the representation discussed in Chapter 2. When an operation such as an addition or multiplication occurs upon a float value, the JVM executes floating-point operations that carry out the proper procedures for addition and multiplication with significands and exponents. For integer addition and multiplication the JVM executes a different set of operations unique to integer type data.

Read the paper · More papers on PaperTik