Access Millions of academic & study documents

Java polymorphism

Content type
User Generated
Showing Page:
1/30

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/30

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/30

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 30 pages?
Access Now
Unformatted Attachment Preview
By Nancy 2019 | By Nancy | CONFIDENTIAL Objective-Day3(1 hour) Runtime Polymorphism  static and Dynamic binding  Abstract class and Interface  2019 | By Nancy | CONFIDENTIAL Remember compile time polymorphism?  Rules for Method Overloading 1. 2. 3. 4. 5. 6. 7. Overloading can take place in the same class or in its sub-class. Constructor in Java can be overloaded Overloaded methods must have a different argument list. Overloaded method should always be the part of the same class (can also take place in sub class), with same name but different parameters. The parameters may differ in their type or number, or in both. That may have the same or different return types. It is also known as compile time polymorphism. 2019 | By Nancy | CONFIDENTIAL Run time/Dynamic polymorphism? Method overriding is an example of run time polymorphism.  Declaring a method in subclass which is already present in parent class is known as method overriding.  The main advantage of method overriding is that the class can give its own specific implementation to a inherited method without even modifying the parent class(base class).  2019 | By Nancy | CONFIDENTIAL Rules for Method Overriding: 1. 2. 3. 4. 5. 6. 7. 8. applies only to inherited methods object type (NOT reference variable type) determines which overridden method will be used at runtime Overriding method can have different return type. Overriding method must not have more restrictive access modifier Abst ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4