G
gast
Gast
Gute nacht liebe Leutz,
In meinem coding stimmt was nicht aber was?
die ausgabe sieht irgendwie ganz komisch aus...
Und die Ausgabe sieht so aus:
Sie habenBuch@42e816undCD@9304b1gekauft
Kann mir bitte jmd. sagen was ich falsch gemacht habe?
In meinem coding stimmt was nicht aber was?
die ausgabe sieht irgendwie ganz komisch aus...
Code:
interface IF_Bestell{
void bestellen(int ID, String Titel);
}
class Buch implements IF_Bestell{
private int ID;
private String Titel;
private static int Gesamt;
Buch(int ID, String Titel){
this.ID=ID;
this.Titel=Titel;
Gesamt=Gesamt+Gesamt;
}
public void bestellen(int ID, String Titel){}
}
class CD implements IF_Bestell{
private int ID;
private String Titel;
private static int Gesamt;
CD(int ID, String Titel){
this.ID=ID;
this.Titel=Titel;
Gesamt=Gesamt+Gesamt;
}
public void bestellen(int ID, String Titel){}
}
public class Testbestellung{
public static void main (String []args){
IF_Bestell []iarr = new IF_Bestell [4];
iarr [0]= new Buch(33,"Programmieren in Java");
iarr [1]= new Buch(32,"Java,von Kopf bis Fuß");
iarr [2]= new CD (31,"Britney Spears");
iarr [3]= new CD (30,"Rihanna");
iarr [0].bestellen(2,"Programmieren in Java");
iarr [2].bestellen(3," Java, von Kopf bis Fuß");
System.out.println("Sie haben" +iarr[0]+ "und" +iarr[2]+ "gekauft");
}
}
Und die Ausgabe sieht so aus:
Sie habenBuch@42e816undCD@9304b1gekauft
Kann mir bitte jmd. sagen was ich falsch gemacht habe?