Junior — Middle
Can you give examples of reference data types you've encountered?
sobes.tech AI
Answer from AI
Reference data types are types that store references to objects in memory, rather than the data itself. Examples of such types in different languages:
- In Java:
String,ArrayList,HashMap, user-defined classes (e.g.,User,Order) - In C#: classes (
class), interfaces, delegates - In Python: all objects (lists, dictionaries, strings, classes) are reference types
For example, in Java, a variable of type String contains a reference to a string object in the heap, not the text itself.