Presentation is loading. Please wait.

Presentation is loading. Please wait.

Under the Hood: A Map This slidedeck shows the various kinds of information that Java tracks under the hood as you create classes and objects and evaluate.

Similar presentations


Presentation on theme: "Under the Hood: A Map This slidedeck shows the various kinds of information that Java tracks under the hood as you create classes and objects and evaluate."— Presentation transcript:

1 Under the Hood: A Map This slidedeck shows the various kinds of information that Java tracks under the hood as you create classes and objects and evaluate expressions. The first slide shows a blank map. The rest of the slides show how the map gets populated as you execute various expressions.

2 KNOWN CLASSES OBJECTS NAMED VALUES EXPRESSION (impact on other areas are in red)

3 KNOWN CLASSES OBJECTS NAMED VALUES class Dillo { int length; … } EXPRESSION (impact on other areas are in red) class Dillo { int length; boolean isDead; Dillo (int length, boolean isDead) { this.length = length; this.isDead = isDead; } A class expression adds to the known-classes area

4 KNOWN CLASSES OBJECTS NAMED VALUES new Dillo (5, false) EXPRESSION (impact on other areas are in red) Dillo length = 5 isDead = false class Dillo { int length; boolean isDead; Dillo (int length, boolean isDead) { this.length = length; this.isDead = isDead; } A new expression adds to the objects area

5 KNOWN CLASSES OBJECTS NAMED VALUES deadDillo = new Dillo (3, true) EXPRESSION (impact on other areas are in red) Dillo length = 5 isDead = false class Dillo { int length; boolean isDead; Dillo (int length, boolean isDead) { this.length = length; this.isDead = isDead; } Dillo length = 3 isDead = true deadDillo An = expression yields a named value Note there is no way to access the live dillo (but it still exists)

6 KNOWN CLASSES OBJECTS NAMED VALUES anotherDeadDillo = new Dillo (3, true) EXPRESSION (impact on other areas are in red) Dillo length = 5 isDead = false class Dillo { int length; boolean isDead; Dillo (int length, boolean isDead) { this.length = length; this.isDead = isDead; } Dillo length = 3 isDead = true deadDillo Dillo length = 3 isDead = true anotherDeadDillo It is fine to have multiple objects with the same field values.


Download ppt "Under the Hood: A Map This slidedeck shows the various kinds of information that Java tracks under the hood as you create classes and objects and evaluate."

Similar presentations


Ads by Google