In the character class main method, implement code to demonstrate applying the above classes as follows: (a) Declare a Character reference variable and create one of your custom character objects to store in it (b) Create an Item object for use by the character (c) Simulate the character receiving and using the item by calling character class method.
Make UML diagrams for your character class and item class, including fields
import java.io.*;
class MyClass {
int a = 40;
int b = 75;
int display(MyClass m1, MyClass m2)
{
m1.a = 47;
System.out.println("a = " + a);
System.out.println("b = " + b);
return 0;
}
}
class Main {
public static void main(String[] args)
{
MyClass m3 = new MyClass();
MyClass m4 = new MyClass();
m4.b = 112;
m3.display(m3, m4);
m4.display(m3, m4);
}
}
Comments
Leave a comment