Hallo,
Wenn ich die Main Methode in der Klasse Apple laufen lasse steht in der Output:
run:
i am the new method of tuna
apples.Tuna@7852e922
i am the eat method
apples.Potpie@4e25154f
BUILD SUCCESSFUL (total time: 0 seconds)
ich verstehe nicht wo mein Fehler ist... warum steht da "apples.Tuna@7852e922" und "apples.Potpie@4e25154f"??
Wenn ich die Main Methode in der Klasse Apple laufen lasse steht in der Output:
run:
i am the new method of tuna
apples.Tuna@7852e922
i am the eat method
apples.Potpie@4e25154f
BUILD SUCCESSFUL (total time: 0 seconds)
ich verstehe nicht wo mein Fehler ist... warum steht da "apples.Tuna@7852e922" und "apples.Potpie@4e25154f"??
Java:
package apples;
public class Apples {
public static void main(String[] args) {
Tuna t = new Tuna();
Potpie p = new Potpie();
t.eat();
System.out.println(t);
p.eat();
System.out.println(p);
}
}
Java:
package apples;
public class Tuna extends Food {
@Override
public void eat(){
System.out.println("i am the new method of tuna");
}
}
Java:
package apples;
public class Potpie extends Food{
}
Java:
package apples;
public class Food {
public void eat(){
System.out.println("i am the eat method");
}
}