Class | Cat |
Object / Instance | Snowy |
Method | meow(3), sleep(), eat() |
Attribute / Field | name, age, weight |
Constructor | Create a new cat object (e.g. Snowy) |
Class | Dog |
Object / Instance | Chuck |
Method | bark(2), sleep(), eat() |
Attribute / Field | name, age, weight |
Constructor | Create a new dog object (e.g. Chuck) |
Class
Methods
Attributes/Fields
Constructor
1
2
3
4
(View > Tool Windows > Structure)
Tank myTank;
myTank = new Tank(400);
myTank.faceLeft();
myTank.move();
Declare new variable myTank of type Tank (just a reference!)
Assign new Tank object to variable
Call faceLeft method on Tank object
Call move method on Tank object
Tank myTank;
myTank = new Tank(400);
Tank object
direction 1
x 400
myTank
Tank myTank = new Tank(400);
Tank object
direction 1
x 400
myTank = new Tank(99);
myTank
Tank myTank = new Tank(400);
Tank object
direction 1
x 400
myTank
myTank = new Tank(99);
Tank object
direction 1
x 99
Tank myTank = new Tank(400);
Tank object
direction 1
x 400
myTank
Tank myTank2 = myTank;
myTank2
myTank.faceLeft();
myTank
Tank object
direction 1
x 400
myTank.faceLeft();
myTank
Tank object
direction -1
x 400
myTank.move();
x 400
direction -1
Tank object
myTank
myTank.move();
x 399
direction -1
Tank object
myTank
Tank
move
Tank
handleBoundary
Tank.move
GamePanel.drawMissiles
GamePanel.drawMissiles
GamePanel
drawMissiles
SIGame
getMissiles
GamePanel
drawMissile
Missile
getX
Missile
getY
Note: constructors are just methods in call graphs, e.g.
Person
Person