forked from SadeeshaJayaweera/Java-Practical-Codes-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem_Monster_Main.java
More file actions
35 lines (28 loc) · 1.29 KB
/
Copy pathItem_Monster_Main.java
File metadata and controls
35 lines (28 loc) · 1.29 KB
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
/*
This is the main Class that we created to perform and check all the methods within the monster and Item
class - Question No 7
*/
public class Item_Monster_Main {
public static void main( String [] args)
{
// Creating an Object for Item Class
Item obj1 = new Item(200,"Kandy");
System.out.println("Location: " +Item.getLocation());
System.out.println("Description: " +Item.getDescription());
//Creating an Object for Monster Class
Monster obj2 = new Monster(300, "Pasikuda");
System.out.println("Location: " +Monster.getLocation());
System.out.println("Description: " +Monster.getDescription());
System.out.println("");
//Using Setter Method and Getter Method to Update Item
Item.setLocation(900);
Item.setDescription("Canada");
System.out.println("The Updated Location is: " +Item.getLocation());
System.out.println("The Updated Description is: " +Item.getDescription());
//Using Setter and Getter Method to Update Monster
Monster.setLocation(1500);
Monster.setDescription("California");
System.out.println("The Updated Location is: " +Monster.getLocation());
System.out.println("The Updated Description is: " +Monster.getDescription());
}
}