-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMain.java
More file actions
36 lines (24 loc) · 771 Bytes
/
Copy pathMain.java
File metadata and controls
36 lines (24 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*An object is essentially an instance of a class*/
public class Main
{
public static void main(String [] args)
{
//Create 1st dog object
Dog blanco = new Dog("Blanco", 5);
//I want to invoke the speak method
blanco.speak();
//Create 2nd dog object
Dog eva = new Dog("Eva", 2);
//I want to invoke the speak method
eva.speak();
//Create 3rd dog object
Dog yorkie = new Dog("Yorkie", 4);
//I want to invoke the speak method
yorkie.speak();
yorkie.speak();
Cat carla= new Cat("Carla", 19, 13);
carla.speak();
carla.eat(3);
System.out.println(carla.getFood());
}
}