• + 0 comments
    import java.io.*;
    import java.util.*;
    
    class Cycle{
        private String technology = "pedals";
        void myFunc(){
            System.out.println("My ancestor is a cycle who is a vehicle with " + technology +  ".");
        }
    }
    
    class Motorcycle extends Cycle{
        private String technology = "engine";
        void myFunc(){
            System.out.println("Hello I am a motorcycle, I am a cycle with an " + technology +  ".");
        }
        void displayInfo(){
            myFunc();
            super.myFunc();
        }
    }
    
    public class Solution {
    
        public static void main(String[] args) {
            Motorcycle honda = new Motorcycle();
            honda.displayInfo();
        }
    }