[HIGHLIGHT="Java"]//thiss.java
public class thiss{
public static void main(String[] args){
Auto xy=new Auto(3,4,5);
System.out.println("\n"+xy.x+"\n"+xy.y+"\n"+xy.z);
}}
class Auto{
int x,y,z;
Auto(int x,int y,int z){
this(y,z);
this.x=x;
System.out.println("1.Konstruktor");
}
Auto(int y,int z){
this(z);
this.y=y;
System.out.println("2.Konstruktor");
}
Auto(int z){
this();
this.z=z;
System.out.println("3.Konstruktor");
}
Auto(){
System.out.println("4.Konstruktor");
}
}[/HIGHLIGHT]
Wieso wird als erstes der 4. Konstruktor aufgerufen muss doch von 1 zu 4?
public class thiss{
public static void main(String[] args){
Auto xy=new Auto(3,4,5);
System.out.println("\n"+xy.x+"\n"+xy.y+"\n"+xy.z);
}}
class Auto{
int x,y,z;
Auto(int x,int y,int z){
this(y,z);
this.x=x;
System.out.println("1.Konstruktor");
}
Auto(int y,int z){
this(z);
this.y=y;
System.out.println("2.Konstruktor");
}
Auto(int z){
this();
this.z=z;
System.out.println("3.Konstruktor");
}
Auto(){
System.out.println("4.Konstruktor");
}
}[/HIGHLIGHT]
Wieso wird als erstes der 4. Konstruktor aufgerufen muss doch von 1 zu 4?