class Objectsmultiplecnstrctrs {
public static void main(String args[]){
ObjectsForMultipleConstructors engg2=new ObjectsForMultipleConstructors(1);
ObjectsForMultipleConstructors engg3=new ObjectsForMultipleConstructors(1,2);
ObjectsForMultipleConstructors engg=new ObjectsForMultipleConstructors(1,2,3);
}
}
// secondary class
public class ObjectsForMultipleConstructors {
private int hour;
private int minute;
private int second;
public ObjectsForMultipleConstructors(int h){
this.hour=h;
System.out.printf("give one ",+hour);
}
public ObjectsForMultipleConstructors(int h,int m){
System.out.printf("goddamn ",+m);
}
public ObjectsForMultipleConstructors(int h,int m,int s){
System.out.println("guess");
}
}
OUTPUT is give one goddamn guess
Now the thing is i have declared int hour =h and value of h I assigned in the arguments in the main class,so im expecting the value of h which i defined to be displayed next to the text (System.out.printf("goddamn ",+m);) ,,but its doing what i want it to do ,where im missing