Modify my code by using another way to take advantage of the dynamic binding in the code.
Fantastic news! We've Found the answer you've been seeking!
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 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(); } }
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date: