This file contains hidden or 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 interfaces; | |
| public class Arayuzler { | |
| public static void main(String[] args) { | |
| Kopekler kopek = new Kopekler(); | |
| kopek.yemekYe(); | |
| } |
This file contains hidden or 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 interfaces; | |
| public class Arayuzler { | |
| public static void main(String[] args) { | |
| Kopekler kopek = new Kopekler(); | |
| Koyunlar koyun = new Koyunlar(); | |
| kopek.yemekYe(); |
This file contains hidden or 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(); |
This file contains hidden or 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) { | |
| // Hayvanlar hayvanlar = new Hayvanlar(); | |
| // Bu kesinlikle hata verecektir | |
| // Soyut sınıftan nesne oluşturulamaz | |
This file contains hidden or 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 polymorphism; | |
| public class CokBicimlilik { | |
| public static void main(String[] args) { | |
| Hayvan hayvan = new Hayvan(); | |
| Hayvan kedi = new Kedi(); | |
| Hayvan kopek = new Kopek(); | |
This file contains hidden or 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 polymorphism; | |
| public class CokBicimlilik { | |
| public static void main(String[] args) { | |
| Hayvan hayvan = new Hayvan(); | |
| Hayvan kedi = new Kedi(); | |
| Hayvan kopek = new Kopek(); | |
This file contains hidden or 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 inheritance; | |
| public class Kalitim { | |
| public static void main(String[] args) { | |
| // Her iki sınıftanda nesne oluşturduk | |
| Arac arac = new Arac(); | |
| Kamyon kamyon = new Kamyon(); | |
This file contains hidden or 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 inheritance; | |
| public class Kalitim { | |
| public static void main(String[] args) { | |
| // Her iki sınıftanda nesne oluşturduk | |
| Arac arac = new Arac(); | |
| Kamyon kamyon = new Kamyon(); | |
This file contains hidden or 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
| class Arac{ | |
| } | |
| // Önce ana sınıfın adı girilir | |
| // Daha sonra extends kelimesi | |
| // Son olarak miras alınacak sınıf girilir | |
| class Kamyon extends Arac{ |
This file contains hidden or 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 encapsulation; | |
| public class Kapsulleme { | |
| public static void main(String[] args) { | |
| Araba araba = new Araba(); | |
| araba.setRenk("Mavi"); | |
| araba.setRenk("Siyah"); |
NewerOlder