Java examples for Object Oriented Design:Method
Pass-by-value does not change local variable of calling functions
public class Main{ static void F(double x) { x = 3; // Here is the catch. Take care of pass-by-value. System.out.println("Before exiting F, value of x:" + x); }/*from w ww. j a v a2s . c om*/ public static void main(String[] args) { double x = 5; F(x); System.out.println("value of x:" + x); } }