[Java] Praktikum 5 : Contoh function

-[Java]  Praktikum 5 : Contoh function- ini merupakan lanjutan dari postingan : ALGORITMA DAN PEMROGRAMAN MODUL 1 SUB PROGRAM (Pro...

-[Java] Praktikum 5 : Contoh function-
ini merupakan lanjutan dari postingan :

ALGORITMA DAN PEMROGRAMAN

MODUL 1 SUB PROGRAM (Procedure & Function).


e. Praktikum 5

contoh 1 :
public class Fungsi1{
public static void garis(){
System.out.println("================");
}
public static void main(String args[]){
garis();
}
}

Hasil Output :


================



contoh 2 :
public class Fungsi3
{
public static int jumlah(){
int a = 7, b = 15;
return (a + b);
}
public static void main(String args[]){
System.out.println("Hasil pemanggilan method jumlah");
System.out.println(jumlah());
}
}
 Hasil Output :

Hasil pemanggilan method jumlah
22

Penjelasan :
Method diatas bersifat static dan bertipe void. Method yang bersifat static bisa langsung dipanggil dengan nama methodnya saja. Sebuah method juga bisa dipanggil lebih dari satu kali.




Demikian contoh  Pratikum (Procedure dan Function). semoga bermanfaat.

COMMENTS

BLOGGER

Nama

Artikel,66,Cerita singkat,82,Java,12,SEO,15,Tahukah sobat??,21,Tips dan Trik,15,Tips.....n' Trick.....,14,Tutorial,20,Tutorial Blogger,50,
ltr
item
Blog Salman Syuhada: [Java] Praktikum 5 : Contoh function
[Java] Praktikum 5 : Contoh function
https://4.bp.blogspot.com/-BkHYtO3Hn34/T8HOOc31yWI/AAAAAAAABTA/Ydw6TrS1Qz8/s1600/java.jpeg
https://4.bp.blogspot.com/-BkHYtO3Hn34/T8HOOc31yWI/AAAAAAAABTA/Ydw6TrS1Qz8/s72-c/java.jpeg
Blog Salman Syuhada
http://blog.salmansyuhada.com/2012/05/praktikum-5.html
http://blog.salmansyuhada.com/
http://blog.salmansyuhada.com/
http://blog.salmansyuhada.com/2012/05/praktikum-5.html
true
5369818979434965955
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy