hello,
I have this question to ask from you...

when passing a object to a method is it pass by reference or pass by value ? I'm talking about calling another class's method...

In java, objects, arrays and strings are always passed by reference. Only primitive types (byte, char, int, long) are passed by value.

In java, objects, arrays and strings are always passed by reference. Only primitive types (byte, char, int, long) are passed by value.

thanks

Not technically correct. In Java, everything is passed by value. You can read about it here.

That's right. Java is only pass by value, regardless of whether parameters are primitive types or reference types.

When the method or constructor is invoked (ยง15.12), the values of the actual argument expressions initialize newly created parameter variables, each of the declared Type, before execution of the body of the method or constructor.

Java Language Specification section 8.4.1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.