Java Programming Tutorial - 56 - Polymorphic Arguements

package apples;

public class Fatty {
 public void  digest (b x) {
x.eat();
}

}
package apples;

public class boy {
public static void main (String []args) {
Fatty thileban = new Fatty(); 
b banana = new b();
thileban.digest(banana);
}
}

package apples;

public class boy {
public static void main (String []args) {
Fatty thileban = new Fatty(); 
b banana = new b();
b po = new apples();
thileban.digest(banana);
thileban.digest(po);
}
}

Comments