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
Is hashmap thread safe?
What is consumer interface?
Can we override constructor?
Difference between stack and queue?
What super () does in java?
What is a native method in java programming?
How many inner classes can a class have?
What does system out println () do?
Explain about wait() method?
Explain about class in java?
What happens if main method is not static?
What is functional interface in java example?
What is an abstract class and what is it’s purpose?
What is equals method in java?
When a byte datatype is used?