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
What is void keyword?
Explain the use of shift operator in java. Can you give some examples?
What are access specifiers in java ?
Can constructor be inherited?
Can we return null in java?
what is meant by Garbage collection?
What is an enumeration?
Is java an ide?
What are the basic control structures?
How will you load a specific locale?
What is hash in java?
What is replaceall in java?
Is it possible to override the main method?
What do you understand by access specifiers in Java?
why an outer class cannot be declared as private?