Created
September 4, 2020 19:20
-
-
Save mrnirva/8c3ba8dedc9b8cf820531a2df4c7696e to your computer and use it in GitHub Desktop.
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 metotlar; | |
public class Metotlar { | |
public static void main(String[] args) { | |
// Nesne Oluşturarak Metoda Erişmek | |
// Aşağıdaki karesiniAl metodumuz Metotlar isimli sınıfımızın bir üyesi | |
// Bu nedenle Metotlar sınıfıyla erişmemiz gerekiyor | |
// Metotlar sınıfından bir nesne aşağıdaki gibi oluşturulur | |
// Daha sonra bu nesne içerisinden karesiniAl'a nokta yardımıyla erişilir | |
Metotlar m = new Metotlar(); | |
System.out.println(m.karesiniAl(12)); | |
} | |
// static anahtar kelimesini sildik | |
int karesiniAl(int sayi){ | |
int karesi = sayi * sayi; | |
return karesi; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment