answersLogoWhite

0

Both are functions, i.e., places where you can write code. A constructor is simply a special method that is invoked automatically when an object is created.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

Is constructor overloading same as method overloading.yes or no. explain?

yes,because in constructor overloading constructor have same and different parameter list. In method overloading method have same name and different parameter list.


What is first call in struts2 default constructor or validate method?

Default Constructor will be called first . If you override Validate method , then validate method will be called .


Can a constructor be defined within a method in java?

No.


What is a no args constructor?

No args means no arguments. Just like any regular method, a constructor can have zero or more arguments.No args means no arguments. Just like any regular method, a constructor can have zero or more arguments.No args means no arguments. Just like any regular method, a constructor can have zero or more arguments.No args means no arguments. Just like any regular method, a constructor can have zero or more arguments.


Differene betwee constructor overloading same as method overloading?

A constructor is just a special form of a method. You can overload constructors in the exact same way as you can overload any other method.


What is a constructor and its mandatory to use constructor in a class?

A constructor is a method that is invoked when an object is created. As to being mandatory, that really depends on the programming language; in the case of Java, each class must have a constructor, however, in many cases Java will automatically provide a default constructor, so you don't really need to program it.


Which is the most usable method or constructor in java?

There is no comparison between methods and constructors. They are both present for a reason and each has its own purpose.


What is the difference between constructor and friend function in c plus plus?

A constructor is a method that fires when the object is instantiated. A friend function is a function that has special access to the object. They are two different types of things, and cannot be further differenced.


What is the diffferent between renewable from non-renewable?

euklhtl3uiruneuo;


What is the difference between implicit and explicit call of constructor in c plus plus?

An implicit constructor call will always call the default constructor, whereas explicit constructor calls allow to chose the best constructor and passing of arguments into the constructor.


A subclass can call constructor method defined by its super class?

True


Why constructor rather than classes in java?

Constructor is not an alternative to class. In Java, you create classes; the classes contain methods - including the constructor, which can be viewed as a special method. If you want to have a constructor, you need a class that surrounds it, so it's not one or the other.