Before: 27 After: 27
Notice that the zero() method did not change the
value held in the main() method's variable.
| The program: | Full description of the action: |
|---|---|
// Review Program
//
class Alteration
{
void zero ( int x )
{
x = 0;
}
}
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 );
}
}
|
|