package poly;
class Employee{
public void func() {
System.out.println("Bu empden");
}
}
class Manager extends Employee{
public void func() {
System.out.println("Bu mngden");
}
}
public class Main {
public static void main(String[] args) {
Employee emp1 = new Employee();
emp1.func();
Employee emp2 = new Manager();
emp2.func();
Manager mng = new Manager();
mng.func();
Manager mng1 = new Employee();
mng1.func();
/* SONUCLAR:
run:
Bu empden
Bu mngden
Bu mngden
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types
required: poly.Manager
found: poly.Employee
at poly.Main.main(Main.java:28)
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
*/
}
}
Aklımda Kalası Kelimeler
* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur
4 Ekim 2009 Pazar
Javada Class Yapıları
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder