JAVA

Reference Data Type in Java

seoca 2019. 2. 20. 12:39



Unlike primitive data type, the reference data type is user-defined, for which it contains a 

reference or an address. It has Array type, Class type and Interface type etc.


create a reference data type 

Person p;  

allocated statically in the stack at compile time.


create a reference data type and object

Person p = new Person(); 

allocated dynamically in the heap




Reference

https://www.quora.com/What-are-reference-data-types-in-Java

https://www.quora.com/What-is-the-difference-between-a-reference-variable-and-an-object-in-Java-How-can-I-create-both