Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myApp;
- public class test {
- public static void main(String[] args) {
- /* Adult class tester */
- Adult p1 = new Adult("Person 1", 1.7, "Student");
- p1.showSummary();
- Adult p2 = new Adult("Person 2", 1.8);
- p2.showSummary();
- Adult p3 = new Adult(p1);
- p3.showSummary();
- System.out.println("New updated information:");
- p1.setName("Person 1.1");
- p1.showSummary();
- System.out.println();
- /* Rectangular class tester */
- //create & print new object's details
- Rectangular recObj1 = new Rectangular();
- recObj1.details();
- //copy previous object to a new, 2nd object
- Rectangular recObj_dup = new Rectangular(recObj1);
- recObj_dup.details();
- //create 3rd object
- Rectangular recObj2 = new Rectangular(23.1, 12);
- recObj2.details();
- //change 3rd object's properties, print details
- recObj2.setHeight(5);
- recObj2.setWidth(13);
- recObj2.details(" /__-> ");
- //print the object (width * char * height)
- System.out.printf("%nPrinting (%s)...:%n", recObj2);
- recObj2.print('z');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment