Site hosted by Angelfire.com: Build your free website today!
       
The Digital Reference Section


JAVA Pass by Value
Rodelio P. Barcenas

The example program below shows how data are passed to a method for processing;

public class returnType{

public static void main(String arg[]){

int a;
increment(a);

}

public void increment(int x){

x = x + 1;
System.out.println(x);

}

}

the value of int a is passed by value to increment() method:

 

 

The PinoyTechZone.Com
Copyright 2002-2003
All rights Reserved