public class ConstructorOnly {
String name = "Mr. Shivam Parashar";
ConstructorOnly(short workedDays) {
System.out.println(name+"'s worked days are : "+workedDays);
}
ConstructorOnly(boolean isWorking) {
System.out.println(name+"'s work current Status(Active in company) is : "+isWorking);
}
public static void main(String[] args) {
ConstructorOnly call2 = new ConstructorOnly(30000);//Salary
ConstructorOnly call3 = new ConstructorOnly(2); //worked Days
}
}
Two parametrized constructor with data type double, short how can we call both but in result reflect only double data type parametrized constructor only
[code]public class ConstructorOnly { String name = "Mr. Shivam Parashar"; ConstructorOnly(short workedDays) { System.out.println(name+"'s worked days are : "+workedDays); } ConstructorOnly(boolean isWorking) { System.out.println(name+"'s work current Status(Active in company) is : "+isWorking); } public static void main(String[] args) { ConstructorOnly call2 = new ConstructorOnly(30000);//Salary ConstructorOnly call3 = new ConstructorOnly(2); //worked Days } } [/code] [code]Two parametrized constructor with data type double, short how can we call both but in result reflect only double data type parametrized constructor only[/code] [code]Both parametrized constructor double and short implementation should print[/code] Результат: - Г-н. Заработная плата Шивама Парашара в компании: 30000,0 Mr. Зарплата компании Шивама Парашара: 2,0
У меня есть жесткое требование, чтобы один из моих классов ClassX создавался рефлексивным образом с помощью стороннего модуля Modul3P, вызывающего конструктор ClassX по умолчанию. Затем Modul3P вызывает один из методов экземпляра, aMethod():...