Professional Documents
Culture Documents
Pass by Ref and Pass by Val
Pass by Ref and Pass by Val
{
public static void main(String[] args)
{
int number = 8, result;
System.out.println("In caller, after calling the method, number is: " + number); // 8
// Return number + 1
public static int increment(int no)
{
System.out.println("Inside method, before operation, number is " + no); // 8
++no; // change the parameter