Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How does abstract modifier work?

Answer Posted / javamasque

Abstract means no concrete, it isn’t directly used. It depends on an implementation to be used. The abstract key word can be used before class (top-level/inner) or method.

Abstract class
• If we make a class abstract, it is not directly instantiated. It have to have a child class to be used.
• It is only be used through inheritance.
• The legacy or common functionality are kept in abstract class.
• It is also used for up casting and dynamic polymorphism.
• It is mostly used in factory design pattern.
• An abstract class can implement and extends another interface and class.

Abstract method
• An abstract doesn’t have any body.
• It has to have an override non-abstract method.
• If a class has an abstract method, then the class has to be abstract.
• An abstract method can only be set visibility modifier either public or protected.

Abstract inner class
• An inner class can be abstract but it is not commonly used and is not recommended also.
• A tight coupling utility is implemented as inner class but if the utility is too complex and we need to segregate into different inner subclasses, then we should go for abstract inner class. The scenario is very rare and it may not come in web applications but may come very big swing application.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is widening and narrowing in java? Discuss with an example.

987


What are the different types of collections in java?

918


How do you use parseint in java?

938


How to calculate the length of a singly linked list in java?

965


Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?

943


What is meant by tab pans?

1133


What is a buffer in java?

974


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

1078


Explain the meaning of java applet.

1017


What is java english?

912


What is meant by vector class, dictionary class, hash table class, and property class?

1085


What will happen to the exception object after exception handling?

946


Differences between C and Java?

1118


What is the purpose of the finalize() method?

1179


How do you declare an array that will hold more than 64KB of data?

1192