Cracking the Java Coding Interview pdfdrive com


Download 1.48 Mb.
Pdf ko'rish
bet11/182
Sana02.05.2023
Hajmi1.48 Mb.
#1423275
1   ...   7   8   9   10   11   12   13   14   ...   182
Bog'liq
Cracking the Java Coding Interview ( PDFDrive )

oriented design as a working system. Languages such as C, on the other hand, are procedural programming languages, so programming tends to be action-oriented. In C, the unit of
programming is the function. In Java, the unit of programming is the class from which objects are eventually instantiated (a fancy term for “created”). Java classes contain methods (that
implement class behaviors) and attributes (that implement class data).


implement class behaviors) and attributes (that implement class data).
C programmers concentrate on writing functions. Groups of actions that perform some common task are formed into functions, and functions are grouped to form programs. Data are
certainly important in C, but the view is that data exist primarily in support of the actions that functions perform. The verbs in a system specification help the C programmer determine the
set of functions needed to implement that system. Java programmers concentrate on creating their own user-defined types called classes and components. Each class contains data and the set
of functions that manipulate that data. The data components of a Java class are called attributes. The function components of a Java class are called methods. Just as an instance of a builtin
type such as int is called a variable, an instance of a user-defined type (i.e., a class) is called an object. The programmer uses builtin types as the “building blocks” for constructing user-
defined types. The focus in Java is on classes (out of which we make objects) rather than on functions. The nouns in a system specification help the Java programmer determine the set of
classes from which objects will be created that will work together to implement the system. Classes are to objects as blueprints are to houses.
We can build many houses from one blueprint, and we can instantiate many objects from one class. Classes can also have relationships with other classes. For example, in an objectoriented

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   7   8   9   10   11   12   13   14   ...   182




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling