English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What is abstract class? Write a program in java to xplain the use of an abstract class.

2007-09-21 20:17:01 · 4 answers · asked by alpha 1 in Computers & Internet Programming & Design

4 answers

a class with some methods defined but not implemented.

you will need to subclass ( extend ) the class and implement the abstract method(s) to make the subclass concrete.

usage is each subcclass can provide its own implementation, if you dont you will get a compile error, if the abstract method was implemented as 'dping nothing' you would find out at runtime that you needed to overwrite the method.

2007-09-21 20:25:47 · answer #1 · answered by gjmb1960 7 · 0 0

an abstract class cannot be instantiated and initialized. it needs to be extended in order to be used. say class Person is abstract.it is declared by using the keyword abstract, in this case: public abstract class Person{/*class definition*/}. for it to be used a concrete class must extend it and override all of Person's listed methods. say: class Student extends Person. abstract classes are used as templates for the make-up of objects that extend it. its methods may or may not do anything and it may or may not have any data members.

2007-09-25 01:11:41 · answer #2 · answered by rodette p 3 · 0 0

the abstract class is ..... well .... it's kinda sashbaraak with a little bit sarmozation thrown at it's face ... u kno ... the apstraisers .... but if ur serious ....u better not take the answer from me !!!

2007-09-21 20:25:31 · answer #3 · answered by YAZANJ 1 · 0 0

one million - public precis type TestClass12 { 2 - public precis void methodName(); } 3 - precis techniques would desire to be applied through extending training, or marked precis. observe you are able to not instantiate an precis type.

2016-10-19 09:36:25 · answer #4 · answered by ? 4 · 0 0

fedest.com, questions and answers