Sort by

recency

|

136 Discussions

|

  • + 0 comments

    Why am I only seeing the Solution class? I do not see any other class nor interface in this activity.

  • + 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();
        }
    }
    
  • + 0 comments

    This is especially useful when the child class wants to enhance or customize behavior without losing the parent’s implementation. It demonstrates key principles of inheritance, polymorphism, and code reuse, which are fundamental to object-oriented programming in Java. Gold365 Login ID and Password

  • + 0 comments

    Am I missing something here or the editor is simply empty with just the plain solution class and main method for every question? Also the question says "complete the partially completed code", where infact theres plain old solution class in editor

  • + 0 comments

    Here is Java Method Overriding 2 (Super Keyword) solution - https://programmingoneonone.com/hackerrank-java-method-overriding-2-super-keyword-solution.html