Java   View all facts   Glossary   Help
object > array
Next objectcurrent object    Upobject    Previous objectuninitialized object   

array
subjectfact 
arraycan be composed of primitive types or instances of classes    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
has definition A collection of data items that are all of the same type, in which each item's position is uniquely designated by an integeradded by: JK, source: Sun Java Tutorial, reference: Glossary, 2001-10-19 11:36:04.0
has a fixed sizeadded by: JK, source: On To Java, 2001-10-19 11:36:04.0
has a mechanism for preventing access outside the bounds of the arrayadded by: Marvin, 2001-10-19 11:36:04.0
has a type which is the type of every data item in the arrayadded by: WH, 2001-10-19 11:36:04.0
has example
//the following sums all the elements of an integer array:
for(int i = 0; i < anIntArray.length; i++)
{
sum += anIntArray[i];
}   
source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
has example of creation
//Create an array called numbers containing 4 integers
int numbers;
numbers = new int [4];
//Or create the array combining the two statements into one
int numbers [] = new int [4];
//Or create the array and initialize it too
int numbers [] = {1, 2, 3, 4};
added by: JK, source: On To Java, 2001-10-19 11:36:04.0
has length stored in the instance variable length    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
is more efficient than specialized collection classes    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
is object-like but is not a true instance of a class    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
is zero-based which means the first element is element 0    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:04.0
is a subtopic of Arrays2001-10-19 11:36:05.0
is created using the new operatoradded by: JK, source: On To Java, 2001-10-19 11:36:05.0
is declared using an array declarationadded by: JK, source: On To Java, 2001-10-19 11:36:05.0
is initialized to default values if it is created using new added by: JK, source: Teach Yourself Java 2 in 21 Days, 2001-10-19 11:36:05.0
is not an instance of a class which you can subclass or for which you can write your own codesource: Object Oriented Software Engineering by Lethbridge and Laganière link:javadocument.html#800, 2001-10-19 11:36:05.0
is a kind of objectadded by: DS, 2001-10-19 11:36:05.0
should be avoided if you do not know beforehand the number of items it will contain    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:05.0
should not be used to manipulate collections of objects    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:36:05.0
object
when an object is created
  1. the object's variables are set to default values
  2. the constructor of the object's superclass is invoked
  3. the object's initialization block is invoked
  4. the object's constructor is invoked
2001-10-19 11:37:31.0
2001-10-19 11:37:31.0
2001-10-19 11:37:31.0
  • when an object is not needed any longer
  • the object's space is garbage collected
2001-10-19 11:37:31.0
can access all instance variables of all objects of its class2001-10-19 11:37:31.0
can be converted into a string using the toString method    2001-10-19 11:37:31.0
can be referred to without reference to the instance variables contained in it    2001-10-19 11:37:31.0
can be referred to by several different variables at the same time    2001-10-19 11:37:31.0
can communicate with every object to which it has access through its public interface2001-10-19 11:37:31.0
can convert itself to a string representation using the toString method    2001-10-19 11:37:31.0
can model    2001-10-19 11:37:32.0
can notify other objects that a condition variable has changed2001-10-19 11:37:32.0
can receive messages from    2001-10-19 11:37:32.0
can represent any entity to which you can associate properties and behaviour    2001-10-19 11:37:32.0
can return its class using the getClass method2001-10-19 11:37:32.0
can send messages to    2001-10-19 11:37:32.0
can wait on 0 or more condition variables2001-10-19 11:37:32.0
communicates with other objects by sending and receiving messages    2001-10-19 11:37:32.0
has part public interface2001-10-19 11:37:32.0
hides methods from other objects using the 'private' keyword2001-10-19 11:37:32.0
inherits instance methods and instance variables from
  • the class to which it belongs
  • all that class's superclasses
2001-10-19 11:37:32.0
is created by
  • declaring and initializing it such that it is created whenever execution enters a particular block, or, in the case of an instance variable, when an instance is created, for example:
    String aString = "some text";
  • or by declaring it and initializing it later using the new operator, for example:
    String aString;
    aString = new String("some text");
2001-10-19 11:37:32.0
shares every instance method of its class with the other instances of its class2001-10-19 11:37:32.0
shares its implementation with other instances of its class2001-10-19 11:37:32.0
shares one copy of each class variable of its class with the other instances of its class    2001-10-19 11:37:32.0
to create you use the new operator2001-10-19 11:37:33.0

Kinds of array :

Next objectcurrent object    Upobject    Previous objectuninitialized object