+ 1
How the reference types work ????
plz give answers with examples
2 Respostas
+ 1
Primitive types include int, double, float, char, boolean, long, byte, and short. Other data types (objects, mostly) are reference types.
For example, the String type is a reference type. The variable that is assigned to the string contains a memory address (a complex sequence of digits consisting of numbers and letters) designates a place in memory for that String. Primitive types refer to their assigned value (e.g. int num = 10; //num refers to 10) whereas objects refer to a memory address.
Memory addresses look similar to this: A@9304b1
Hope this helps!
0
Great but is string type really reference ??? i don't think so. ... give me some code ... of string reference ...