package apples;
public class b {
void eat() {
System.out.println("this food is great");
}
}
package apples;
public class cup extends b {
void eat() {
System.out.println("this cup is great");
}
}
package apples;
public class apples extends b {
void eat() {
System.out.println("these apples are great");
}
}
package apples;
public class boy {
public static void main (String []args) {
b thileban []= new b [2];
thileban[0] = new apples();
thileban[1] = new cup();
for (int x=0; x<2; ++x) {
thileban[x].eat();
}
}
}
Comments
Post a Comment