Question: Modify my code by using another way to take advantage of the dynamic binding in the code. Write the main method to demonstrate the correct
Modify my code by using another way to take advantage of the dynamic binding in the code. Write the main method to demonstrate the correct functionality of the additions/modifications. Be original with your modification. Please post screenshot of your modification!
package dynamicbind; public class dynamicbind { public static class Supclass{ //the parent class, // and this class contains a single method named 'sprint()'. // Methods are binded dynamically void sprint(){ System.out.println("The person on the track team sprints."); // When we will call this method, it will print // "The person from the super class can walk.". } } public static class Subclass extends Supclass{ // Method is overridden and method overriding is an example of dynamic binding // Methods are binded dynamically void sprint(){ System.out.println("The track person from the track team can sprint too."); //achieve method overriding,same print statement } } public static void main(String[] args) { // TODO code application logic here Supclass supclass = new Supclass(); Subclass subclass = new Subclass(); supclass.sprint(); subclass.sprint(); } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
