Reputation: 631
Hi stackoverflow community. This is my first question here.
What is the purpose of the term "builder overload" in java?
examples:
public class HelloWorld{
public HelloWorld(int edad){
}
public HelloWorld(int numero){
}
}
I am new to Java so I apologize if this is a silly question.
Upvotes: 0
Views: 355
Reputation: 373
I think you are looking for Constructor Overloading in Java.
Please refer to the link:
Constructor overloading in Java - best practice
Moreover, constructor overloading also works similar to method overloading i.e. it can have different data type of arguments, different order of arguments, different count of arguments.
Hence, the code specified by you will not work as both the constructors have same definition. However, the below specified example would work.
public class HelloWorld{
public HelloWorld(){
}
public HelloWorld(int numero){
}
}
Upvotes: 2