You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.

Object Oriented Programming

Beeze Aal

Hackerrank Java Iterator Solution

Java Iterator class can help you to iterate through every element in a collection. Here is a simple example:import java.util.*;public class Example{ public static void main(String []args){        ArrayList mylist = new ArrayList();        mylist.add("Hello");        mylist.add("Java");        mylist.add("4");        Iterator it = mylist.iterator();        while(it.
Beeze Aal

Hackerrank Java Instanceof keyword Solution

The Java instanceof operator is used to test if the object or instance is an instanceof the specified type. In this problem we have given you three classes in the editor: Student classRockstar classHacker classIn the main method, we populated an ArrayList with several instances of these classes. count method
Beeze Aal

Hackerrank Java Method Overriding 2 (Super Keyword) Solution

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 partially completed
Beeze Aal

Hackerrank Java Method Overriding Solution

When a subclass inherits from a superclass, it also inherits its methods; however, it can also override the superclass methods (as well as declare and implement new ones). Consider the following Sports class:class Sports{    String getName(){        return "Generic Sports";    }    void getNumberOfTeamMembers(){        System.out.println( "Each team has n players
Beeze Aal

Hackerrank Java Interface Solution

A Java interface can only contain method signatures and fields. The interface can be used to achieve polymorphism. In this problem, you will practice your knowledge on interfaces. You are given an interface AdvancedArithmetic which contains a method signature int divisor_sum(int n). You need to write a class
Beeze Aal

Hackerrank Java Abstract Class Solution

A Java abstract class is a class that can't be instantiated. That means you cannot create new instances of an abstract class. It works as a base for subclasses. You should learn about Java Inheritance before attempting this challenge. Following is an example of abstract class:abstract class Book{    String
Beeze Aal

Hackerrank Java Inheritance II Solution

.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} Write the following code in your editor below: A class named Arithmetic with a method named add that takes  integers as parameters and returns
Beeze Aal

Hackerrank Java Inheritance I Solution

Using inheritance, one class can acquire the properties of others. Consider the following Animal class:class Animal{    void walk(){        System.out.println("I am walking");    }} This class has only one method, walk. Next, we want to create a Bird class that also has a fly method. We do this using