Answer Posted / qim2010
Yes, by using this() syntax. E.g.
public Pet(int id) {
this.id = id; // “this” means this object
}
public Pet (int id, String type) {
this(id); // calls constructor public Pet(int id)
this.type = type; // ”this” means this object
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is this keyword in java?
Do you know how to reverse string in java?
What are the rules for variable declaration?
difference between byte stream class and character stream class?
what is aggregation in java?
What is numel matlab?
Difference between stack and queue?
What is the purpose of default constructor?
How to instantiate static nested classes in java?
What do you mean by chromounits in java8?
What is operator overloading. Is it is supported in java?
What are the various access specifiers in java?
What are inner classes or non static nested classes in java?
How to handle a web browser resize operation?
Can we synchronize static methods in java?