Skip to content

Instantly share code, notes, and snippets.

@SanjeevMohindra
Created February 28, 2016 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SanjeevMohindra/7189c03fe55e1accf2d8 to your computer and use it in GitHub Desktop.
Save SanjeevMohindra/7189c03fe55e1accf2d8 to your computer and use it in GitHub Desktop.
package callbyvalue;
public class PrimitiveCall {
public static void main(String[] args) {
int x = 10;
System.out.println("Value of x before the call: " + x);
add(x);
System.out.println("Value of x after the call: " + x);
}
private static void add(int x) {
x = x + 10;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment