Wednesday, April 30, 2008

Creating and Using Arrays in JAVA :

When a number of data items are chunked together into a unit, the result is a data (online) structure. Data structures can be very complex, but in many applications, the appropriate data structure consists simply of a sequence of data items. Data structures of this simple variety can be either arrays or records.

The term “record” is not used in Java. A record is essentially the same as a Java object that has instance variables only, but no instance methods. Some other languages, which do not support objects in general, nevertheless do support records. The C programming language, for example, is not object-oriented, but it has records, which in C go by the name “struct.”

The
data items in a record—in Java, an object’s instance variables—are called the fields of the record. Each item is referred to using a field name. In Java, field names are just the names of the instance variables.

The distinguishing characteristics of a record are that the data items
in the record are referred to by name and that different fields in a record are allowed to be of different types.

No comments: