Java is a “pass –by-reference”?

I always thought Java was pass-by-reference; however I’ve seen a couple of blog posts that claim it’s not. I don’t think I understand the distinction they’re making.
Could someone explain it please?

in java always pass-by-value. In java difficult thing can be understand that java passes objects as references and those references are passed by value.
For example:
public void foo(Cat c)

{
c.getName().equals(“Max”); // true
c = new Cat(“Fifi”);
c.getName().equals(“Fifi”); // true
}

Cat cat = new Cat(“Max”);
foo(cat);
cat.getName().equals(“Max”); // true
In this example cat.getName() will still return “Max”. c is not overwritten in the function as the object reference is passed by value.

java fallows thae pass-by-value mechanism When assigning an object to a variable, we are actually assigning the memory address of that object to the variable. So the value passed is actually the memory location of the object. This results in object aliasing, meaning you can have many variables referring to the same object on the heap.
class Example
{
public static void test (Cat ref)
{
// 3-ref is a copy of the reference a
// both currently reference Grumpy
System.out.println(ref.getName());

    // 4-now ref references a new object Nyan
    ref = new Cat("Nyan");

    // 5-this will print Nyan
    System.out.println(ref.getName());
}

public static void main (String [] args)
{
    // 1-Cat reference a references Cat object in memory
    Cat a = new Cat("Grumpy");

    // 2-call function test given a copy of reference a
    test (a);

    // 6-function call ends, and the ref life-time ends
    // Nyan object has no references and Garbage
    // collector will remove it from memory

    // 7-this will print Grumpy
    System.out.println(a.getName());
}

}

Java always passes arguments by value NOT by reference.

Let me explain this through an example:

 

public class Main

{

     public static void main(String[] args)

     {

          Foo f = new Foo("f");

          changeReference(f); // It won't change the reference!

          modifyReference(f); // It will modify the object that the reference variable "f" refers to!

     }

     public static void changeReference(Foo a)

     {

          Foo b = new Foo("b");

          a = b;

     }

     public static void modifyReference(Foo c)

     {

          c.setAttribute("c");

     }

}