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

What are EAR, JAR and WAR files in J2EE?

ATG Issue - ConcurrentUpdateException - on BCC Deployment

How the competition helps to reduce the price of TEA?