Java Programlama Dili / Konu: Metotlar - Örnek:1

publicclass nnnn {

 

                publicstaticvoid main(String[] args) {

                               // TODO Auto-generated method stub

               

                               hello();

                              

                }

               

                publicstaticvoid topla(intsayi1,intsayi2)

                {

                               intsonuc;

                               sonuc=sayi1+sayi2;

                               System.out.println(sonuc);

                }

               

                publicstaticvoid carpma(ints1,ints2) {

                               intsonuc;

                               sonuc=s1*s2;

                               System.out.println(sonuc);

                }

               

                publicstaticvoid hello() {

                               System.out.println("merhaba dvtfl");

                               intsayi;

                               sayi=123;

                               System.out.println(sayi);

                              

                }

 

}

Yorum ekle