Download presentation
Presentation is loading. Please wait.
1
Summary of the lecture We introduced the local variable dependency –This is a binary relationship (a relationship between two classes), similar to instantiation dependency –The difference is that the reference to the newly created object is stored in a local variable. –Example is on last two slides is of a local variable dependency between classes A (source) and B (target)
2
Variable declaration A variable declaration consists of two basic things: –the type of the variable –the name of the variable Java insists that all variables be declared before use – not all languages require this.
3
Why are types important Recall the discussion from early in the semester about how to interpret a string like “01001101” – the proper interpretation depends on the encoding scheme (e.g. two’s complement or IEEE754) The type of a variable tells the compiler, among other things, which encoding schemed to use to read/write data from/to the variable.
4
Instantiation Dependency in UML
5
class A – the source class package pkg; public class A { public A() { B b = new B(); }
6
class B – the target class package pkg; public class B { public B() { }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.