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...

Can you have a constructor in abstract class?

Answer Posted / swapnil bhosale

ya ,we can define and call costructor in abstract class but just by using super keyword in base class ,but keep in mind we cannot create instance ob abstract class,this just another way to call contructor in abstract class,go run and see o/p
import java.io.*;
abstract class A
{
A()
{
System.out.println("hi am conS in absT");
}
}
class AA extends A
{
AA()
{
super();//calling abstract constructor
System.out.println("hi i am conS in sub class ");
}
}
class AbstConst2
{
public static void main(String arg[])
{
AA ob=new AA();//creating instance of base class consT
}
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is import java util arraylist?

1185


What is the size of boolean variable?

1079


Why wait and notify methods are declared in object class?

1042


What are the steps in the jdbc connection?

1026


What is return code?

1010


Is there any case when finally will not be executed?

952


How do you write a scanner class in java?

1020


What is matcher in java?

1005


Which class is used by server applications to obtain a port and listen for client requests?

967


Explain method overloading?

1022


What is the purpose of skeleton and stub?

1248


What is indexof?

988


Can we override final method?

1013


How to sort list of list in java?

1094


What is nullpointerexception?

1075