Skip to content

Instantly share code, notes, and snippets.

@mrnirva
Created September 4, 2020 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrnirva/8c3ba8dedc9b8cf820531a2df4c7696e to your computer and use it in GitHub Desktop.
Save mrnirva/8c3ba8dedc9b8cf820531a2df4c7696e to your computer and use it in GitHub Desktop.
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