Call by value in JAVA

public class Test
    public void callByValue(int x)
    public static void main(String[] args)
       int x=50;
        Test t = new Test();

Output is: 50

In the above example, even though the value of X is 100, we are setting local variable as 50 and then calling the "callByValue()" method. So, it will reset the value of x from 100 to 50.

Thus the output is: 50

For more reference:

Popular posts from this blog

[Solved] Hive installation error: Relative path in absolute URI

Install Android SDK in centOs

ATG Issue - ConcurrentUpdateException - on BCC Deployment