Any type of data at all:
short
,
int
, double
Of course, all the cells of an array must be the same type.
We have not much used arrays of object references so far in these notes. This will be discussed in a future chapter.
To start, review parameter passing with primitive variables. Here is a program that does that.
Here is a short program: | Here is a description of the action: |
---|---|
// Review Program
//
class Alteration
{
void zero ( int x )
{
x = 0;
}
}
public class AlterTest
{
public static void main ( String[] args )
{
Alteration alt = new Alteration();
int value = 27;
System.out.println( "Before:" + value );
alt.zero( value );
System.out.println( "After:" + value );
}
}
|
|
What is printed out?