package java_problems.object_oriented_programming;

class BiCycle
{
   String define_me()
   {
      return "a vehicle with pedals.";
   }
}

class MotorCycle extends BiCycle
{
   String define_me()
   {
      return "a cycle with an engine.";
   }
   
   MotorCycle()
   {
      System.out.println("Hello I am a motorcycle, I am "+ define_me());
      String temp=super.define_me();
      System.out.println("My ancestor is a cycle who is "+ temp );
   }
   
}
class MethodOverriding2 {
   public static void main(String []argh)
   {
      MotorCycle M=new MotorCycle();
   }
}
package java_problems.object_oriented_programming;

/*
 * Problem Statement
 * 
 * When a method in a subclass overrides a method in superclass, it is still
 * possible to call the overridden method using super keyword. If you write
 * super.func() to call the function func(), it will call the method that was
 * defined in the superclass.
 * 
 * You are given a code in the editor. Modify exactly 1 line so that the code
 * prints the following text:
 * 
 * Hello I am a motorcycle, I am a cycle with an engine.
 * My ancestor is a cycle who is a vehicle with pedals.
 */
class BiCycle {
	
	String define_me() {
		
		return "a vehicle with pedals.";
	}
}

class MotorCycle extends BiCycle {
	
	String define_me() {
		
		return "a cycle with an engine.";
	}

	MotorCycle() {
		
		System.out.println("Hello I am a motorcycle, I am " + define_me());
		String temp = super.define_me();
		System.out.println("My ancestor is a cycle who is " + temp);
	}

}

class MethodOverriding2 {
	
	public static void main(String[] argh) {
		
		@SuppressWarnings("unused")
		MotorCycle M = new MotorCycle();
	}
}
Update MethodOverriding2