Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

 

Inheritance - is the inclusion of state and behavior of a base class in a derived class so that they are accessible in that derived class. The key benefit of Inheritance is that it gives the formal mechanism for

code reuse. Any shared piece of business logic may be moved from the derived class into the base class as part of refactoring method to improve maintainability of your code by avoiding code duplication. The existing class is called the superclass and the derived class is defined the subclass. Inheritance may also be illustrate as the process whereby one object requires characteristics from one or more other objects the similar way children accepts characteristics from their parents. There are basically two types of inheritances:

 

1. Implementation inheritance: You will extend an application's functionality by reusing functionality in the parent class by extending all or some of the operations already implemented. In Java, you can only add from one superclass. Implementation inheritance promotes reusability but improper use of class inheritance can gives programming nightmares by dividing encapsulation and building future changes a problem. With implementation inheritance, the subclass becomes hardly coupled with the superclass. This will build the design fragile because if you need to change the superclass, you have to know all the details of the subclasses to avoid breaking them. So when using implementation inheritance, make sure that the subclasses relay only on the nature of the superclass, not on the actual implementation.

 

2. Interface inheritance: That is also known as subtyping. Interfaces give a mechanism for specifying a relationship between otherwise unrelated classes, typically by specifying a set of common methods each implementing class must obtain. Interface inheritance provides the design concept of program to interfaces not to implementations. This also reduces implementation dependencies or the coupling between systems. In Java, you will implement any number of interfaces. This is more flexible and reliable than implementation inheritance because it won't restrict you into specific implementations which build subclasses difficult to maintain. So care could be taken not to divide the implementing classes by modifying the interfaces.

 

Java, Programming

  • Category:- Java
  • Reference No.:- M9504957

Have any Question?


Related Questions in Java

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As