Show
Vikram Singh 157 Hi ! want to check the concept of OverridingPublic virtual class Parent9 {
Jyothy Kiran Hi Vikram, The following is an extended example of a class, showing all the features of Apex
classes. The keywords and concepts introduced in the example are explained in more detail throughout this chapter.
Rahul Kumar (Salesforce Developers) Hi, Overriding:
Q.Why
overriding?
Hope it will be helpful. Please mark it as best answer if the information is informative. Thanks
You need to sign in to do that.Dismiss
Which of the following methods can be overridden?Instance methods can be overridden only if they are inherited by the subclass. A method declared final cannot be overridden. A method declared static cannot be overridden but can be re-declared. If a method cannot be inherited, then it cannot be overridden.
When a method override the method in a parent class which of the following are valid?Explanation: When the method overrides the method the object of the parent class will go beyond to revoke the method and parent class version will get executed successfully.
Can a void method be overridden?All answers are correct from a technical point of view because Void is a class in Java that no other class can extend and when methods are overridden the return-type has to be a sub-type of the original type (parentReturnType. isAsignableFrom(overriddenReturnType)).
Which of the following statements must be valid for method overriding in Java?Rules For Method Overriding
A static method cannot be overridden. Private methods cannot be overridden. The return type of the overriding method must be the same. We can call the parent class method in the overriding method using the super keyword.
|