Question
Consider the following code snippet (Java-like):
  class Animal {     public void makeSound() {       System.out.println("Animal makes a sound");     }   }   class Dog extends Animal {     @Override     public void makeSound() {       System.out.println("Dog barks");     }   }   public class Test {     public static void main(String[] args) {       Animal myAnimal = new Dog();       myAnimal.makeSound();     }   }   What will be the output of this code?Solution
This demonstrates runtime polymorphism (method overriding). Even though myAnimal is declared as type Animal, it actually refers to a Dog object. When makeSound() is called, the JVM (Java Virtual Machine) determines the actual type of the object at runtime and invokes the makeSound() method defined in the Dog class.
If a mirror is place on the line XY, then which of the answer figures is the mirror image of the given figure?
ZDEH is related to WFBJ in a certain way based on the English alphabetical order. In 5 the same way, EMOB is related to BOLD. To which of the following ...
Four of the following five are equal in a certain way and form a group.
Which one is not related to that group?
XU, VM, EB, YV, MJ
Ringworm : Skin :: Tapeworm : ?
How many triangles are there in the given figure?Â
Â
Identify the figure given in the options which when put in place of ? will logically complete the series.
Four letter-clusters have been given, out of which three are alike in some manner and one is different. Select the one that is different.
Select the option figure in which the given figure (X) is embedded as its part (rotation is NOT allowed).
Study the given pattern carefully and select the number that can replace the question mark (?) in it.
Select the number that does NOT belong to the given number series.
39, 46, 60, 82, 109, 144