answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: How can you called a constructor inside another constructor?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to create methods in constructor?

You cannot create methods inside a constructor


What is another name of default constructor?

No-Arg Constructor


When is the function constructor called?

A constructor is called when a new object is created.


When the constructor is called how many times will it be copied?

constructor is called every times when we create object of class using new keywordand constructor can not be copied (vinayak shendre)


A default constructor has how many parameters?

None, zero. Example: new MyClass(); //and public classMyClass{} no constructor defined inside of MyClass


What is concession constructor?

Constructors are basically used to evoke methods of a class creating its object..and as far as i know there is no constructor called concession constructor..


What is mean constructor in java?

A parameterized constructor in java is just a constructor which take some kind of parameter (variable) when is invoked. For example. class MyClass { //this is a normal constructor public MyClass(){ //do something } //this is a parameterized constructor public MyClass(int var){ //do something } //this is another parameterized constructor public MyClass(String var, Integer var2){ //do something } }


What happens if a class defines constructor but not one with no argument?

Nothing Happens. Actually such a constructor is called a Default Constructor. Even if we do not write a constructor for a class, Java would automatically place a default constructor inside the class. Ex: Public class Test { public String getName(){ return "Hi"; } } Public class TestEx { public static void main(String[] args){ Test obj = new Test(); System.out.println(obj.getName()); } } Here we were able to instantiate an object of class Test even though we did not define a constructor for that class. This is because Java automatically places a default constructor for the class.


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 you call a constructor from another if a class has multiple constructors?

Yes. All you need to do is to specify the correct number of arguments to invoke the correct constructor.


Why you use constructor instead of function?

For every class an empty constructor will be defined automatically by default unless you provide a constructor definition manually. Constructor in a class can be used to initialize variables or perfrom some basic functionallity whenever an object is created.


When constructor function are called in java?

Constructors are called during object creation.