This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package abstractclass; | |
public class SoyutSinif { | |
public static void main(String[] args) { | |
Baliklar balik = new Baliklar(); | |
Kuslar kus = new Kuslar(); | |
balik.yemekYe(); | |
kus.yemekYe(); | |
} | |
} | |
// Soyut Sınıf | |
abstract class Hayvanlar{ | |
// Soyut Metot | |
abstract void yemekYe(); | |
} | |
// extends ile soyut sınıf miras alınır | |
class Baliklar extends Hayvanlar{ | |
@Override | |
void yemekYe() { | |
System.out.println("Yem İle Beslen"); | |
} | |
} | |
class Kuslar extends Hayvanlar{ | |
@Override | |
void yemekYe() { | |
System.out.println("Balık İle Beslen"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment