Compare an abstract class and an interface , JAVA Programming

Assignment Help:

You want the base class to represent only an interface for its derived classes. That means, you don't want anyone to actually instantiate an object of the parent class. You only want to upcast to it so that its interface may be used. This is accomplished by building that class abstract using the abstract keyword. If anyone tries to build an object of an abstract class, the compiler saves it.

 

The interface keyword makes this concept of an abstract class a step further by preventing any function or method implementation at all. You can only define a method or function but not give the implementation. The class, which is adding the interface, should give the actual implementation. The interface is a commonly and very useful used aspect in OO design, as it gives the implementation and separation of interface and actives you to:

 

1. Use similarities among unrelated classes without artificially forcing a class relationship.

2. Define methods that one or more classes are expected to implement.

3.  Reveal an object's programming interface without revealing its basic implementation.

4. Model multilevel interface inheritance in Java, which gives some of the benefits of full on multiple inheritances, a feature that some object-oriented languages support that allow a class to have more than one parented class.

 

 

155_Untitled.png


Related Discussions:- Compare an abstract class and an interface

What do you understand by java virtual machine, Java Programming 1. Wha...

Java Programming 1. What do you understand by Java Virtual Machine? 2. Write a simple Java program to display a string message and explain the steps of compilation and execu

Program with eclipse and enumeration , Problem Definition A new Met Of...

Problem Definition A new Met Office web application will allow users of their web site to view rainfall statistics for months and years in the UK. The application allows the m

Collection, how would I become expert in collection framework

how would I become expert in collection framework

Java application game of life, The game of Life, invented by John Conway, i...

The game of Life, invented by John Conway, is supposed to model the genetic laws for birth, survival, and death (see Scienti_c American, October 1970, p. 120). We will play it on a

Difference between a scrollbar and a scrollpanel in jsp, A Scrollbar is a C...

A Scrollbar is a Component while Scroll Panel is a Container. A Scroll Panel handles its own events and performs its own scrolling.

Write names of the dos attacks phases, Write names of the DoS attack's phas...

Write names of the DoS attack's phases? DoS (Denail of service): DoS attach has in total 3 kinds of phases and below they are listed: 1. Search 2. Arm 3. Attack

What is the use of textmessage, TextMessage having instance of java.lang.St...

TextMessage having instance of java.lang.String as its payload. Therefore it is very useful for exchanging textual data. It can also be used for exchanging difficult character data

Exercise\servletexercise, Ask question # Write a servlet to display a table...

Ask question # Write a servlet to display a table that contains factorials for the numbers from 0 to 10,

What is static in java, What is static in java? Static means one per cl...

What is static in java? Static means one per class, not one for each object no matter how many example of a class might exist. This means that you can use them without making a

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd