7 AnswersNew Answer
Value type are all the types which with a lowercase letter (e.g. int, float, boolean, ...). When they are passed to a function their value is given to function and thus if they are in changed in the function, the change won't be visible outside the function. Reference types are all the other types. When passed to a function, the reference (or pointer) to the object is passed by value (Java is always passed by value) but since you use a reference to access the object, the modification will be visible outside the function
swali1 Primitive datatypes like int, float, char, long double etc are Valuetype datatypes as they store the actual values in variable of respective datatype All other types are Reference type datatypes because the variable of respective type stores the address/reference of the data types e.g Strings, Arrays, Maps, List extra int i = 10; // i has actual value of 10 String str = "test" str has a reference to the address in memory where the string is actually stored.
swali1 As Paul said in Java everything is pass by value. For primitive data types actual values are pased and for others the reference or address is passed by value. The terminology you have mentioned is misleading but widely use. Just remember everything is "call by value" or "pass by value"
thanks -swim- and Paul
ok ..got it -swim-
is "call by reference"="pass by reference"="reference types" and is "call by value"="pass by value"="value types"
btw can you refer to me a good article ,or thread or post or video ...on this concept of pass by value and pass by reference..it would be really helpful