Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time.java
In this process, an overridden method is called through the reference variable of a super class. The determination of the method to be called is based on the object being referred to by the reference variable.swift
No.this
more details...google
In case of static binding type of object is determined at compile time whereas in dynamic binding type of object is determined at runtime.spa
more details...code
Abstraction is a process of hiding the implementation details and showing only functionality to the user.ip
Abstraction lets you focus on what the object does instead of how it does it.rem
Abstraction hides the implementation details whereas encapsulation wraps code and data into a single unit.
A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated.
No, if there is any abstract method in a class, that class must be abstract.
No, because abstract method needs to be overridden whereas you can't override final method.
No, abstract class can never be instantiated.
Interface is a blueprint of a class that have static constants and abstract methods.It can be used to achieve fully abstraction and multiple inheritance.
No, because methods of an interface is abstract by default, and static and abstract keywords can't be used together.
No, because its implementation is provided by another class.
An interface that have no data member and method is known as a marker interface.For example Serializable, Cloneable etc.
Abstract class | Interface |
---|---|
1)An abstract class can have method body (non-abstract methods). | Interface have only abstract methods. |
2)An abstract class can have instance variables. | An interface cannot have instance variables. |
3)An abstract class can have constructor. | Interface cannot have constructor. |
4)An abstract class can have static methods. | Interface cannot have static methods. |
5)You can extends one abstract class. | You can implement multiple interfaces. |
No, they are implicitly public.
An object reference can be cast to an interface reference when the object implements the referenced interface.
A package is a group of similar type of classes interfaces and sub-packages. It provides access protection and removes naming collision.
No. It is by default loaded internally by the JVM.
One can import the same package or same class multiple times. Neither compiler nor JVM complains about it.But the JVM will internally load the class only once no matter how many times you import the same class.
By static import, we can access the static members of a class directly, there is no to qualify it with the class name.