Site icon Tutor Bin

CMSC 335 Object Oriented Programming Questions

CMSC 335 Object Oriented Programming Questions

Description

1. Explain in a few sentences the inheritance relationship (parent-child) and its use.

2. Explain in a few sentences the polymorphism (child class overriding a method from the parent class) and its use.

a) Write one Java class of your own with one method.

b) Write another (second) Java class that will extend the above Java class and overrides the method from the parent class.

c) Write another (third) Java class that will extend the above Java class and overrides the method from the parent class.

In other words, these two child classes (subclasses) will override the same method of the parent class differently. It will be only a few lines of code in each Java class. Write System.out.println to demonstrate they are printing different result, and that will demonstrate that the methods in the subclasses are producing different results.

Submit the Java code and write a few sentences to explain the expected result/output of your code.

Following are good reads, along with the course material.

https://www.geeksforgeeks.org/overriding-in-java/

https://www.tutorialspoint.com/java/java_overriding.htm

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version