Answer Posted / ranganathkini
Yes once constructor can call another constructor by using
the this() statement. Example:
class Account {
private double balance;
// 1st Constructor
public Account( double initBalance ) {
balance = initBalance;
}
// 2nd Constructor
public Account() {
this( 0.0 ); // call the 1st constructor
}
}
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
Is there any difference between nested classes and inner classes?
Why does java not support pointers?
Explain about the security aspect of java?
What is double parsedouble in java?
What is the function of http?
What is communist flag?
Is main an identifier?
Is heap stored in ram?
Is alive and join method in java?
Can a constructor be private and how are this() and super() method used with constructor?
Can an interface extend another interface?
what is use of functional interface in java 8?
Can a class have multiple constructors?
What is the generic class?
What is method in java ?