Construtor parametrizado
class Main {
String fruits;
// constructor accepting single value
Main(String fruit) {
fruits = fruit;
System.out.println("Fruit " + fruits);
}
public static void main(String[] args) {
// call constructor by passing a single value
Main obj1 = new Main("Banana");
Main obj2 = new Main("Apple");
Main obj3 = new Main("Mango");
}
}
Outrageous Ostrich