Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132939 views
License: OTHER
1
public class Shark {
2
// attributes
3
private Laser laserAttachedToHead;
4
5
// methods
6
public void attack(Enemy e) {
7
this.laserAttachedToHead.fire(e);
8
}
9
10
private void eat() {
11
// rawr!
12
}
13
}
14
15
// invoke method
16
Shark erik = new Shark();
17
erik.attack(somalianPirate);
18
19