🍄 🐘 🦆 🐟 🐍 🦋 🐸 🦖🌳 🌸 🍓 🥒 🍎 🥜🌿
A a = new A();
B b = new B();
a.doA(b);
public class A {
public void doA(B b) {
b.doB();
}
}
public class B {
public void doB() { }
}
Objects
Method Calls
Execution Timeline
Lifelines
A a = new A();
B b = new B();
a.doA(b);
public class A {
public void doA(B b) {
b.doB();
}
public class B {
public void doB() {
this.doB2();
}
public void doB2() { }
}
Call to same object
Method's execution timeline
Lifelines
Method Calls
Objects alive throughout the execution
public class RegistrationSystem {
private List<Student> students;
public void printRecords() {
for (Student s : students) {
print(s.getRec());
}
}
}
Our collection
Loop condition
Loop box
Same for conditionals!
if: ...
else if: ...
else: ...
Note: it's a means of communication! It's not all set in stone!
Recommended procedure: