Skip to content
Advertisement

Tag: reference

Where is the super reference in a Java instance method’s stack frame?

I read Bill Venner’s excellent Inside the Java Virtual Machine book, which, in Chapter 5 explores in detail, among other things, the composition of a JVM’s stack frame. (This chapter from the book also happens to be officially published here: https://www.artima.com/insidejvm/ed2/jvm8.html) Apart from this book I studied relatively much the runtime data areas of some JVM’s, especially their stack and

What is the difference between Address and Reference in Java?

First of all, I know that Java is call by value. However, in a certain article, there is no such thing as an address in Java, and you should use the word reference. In my opinion, both words are interpreted with the same meaning. Am I wrong? What is the difference between address and reference, and do you have such

Java Map for unique object instances?

A library I use contains a certain object type, LackingObject (some type), which lacks an attribute of type Ext (some type). If I was able to change the LackingObject class, I would simply add an attribute with type Ext, but LackingObject cannot be changed, nor extended. What I’d do now in languages like C or C++ is to create a

Reference counting Java

Consider the following java code: class Person { String name; int age; } Person p1 = new Person(); Person p2 = new Person(); Person p3 = p2; p3 = p1; How many total objects and reference …

Duplicating objects in Java

I learned that when you modify a variable in Java it doesn’t change the variable it was based on I assumed a similar thing for objects. Consider this class. After I tried this code I got confused. Please explain to me why changing any of the objects affects the other one. I understand that the value of variable text is

Advertisement