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
I want to re-reach and use an object once it has been garbage collected. How it's possible?
How to instantiate static nested classes in java?
What are the main differences between notify and notifyAll in Java?
What is finalize method?
Why do we need wrapper class?
Is boolean a wrapper class in java?
What is the difference between heap and stack memory?
Difference between linkedlist and arraylist.
How many types of constructors are used in java?
How many types of classes are there in java?
What are the rules for naming an array?
Explain about static imports in java?
What is use of set in java?
How do you detect memory leaks?
define polymorphism in java