Thursday, 10 May 2018

Java: Static Methods

Static Method adalah suatu nama group dari statement yang bertujuan menunjukkan struktur program dan menghilangkan duplikasi.

Contoh source code:
public class FreshPrince {
    public static void main(String[] args) {
        rap();                 // Calling (running) the rap method
        System.out.println();
        rap();                 // Calling the rap method again
    }

    // This method prints the lyrics to my favorite song.
    public static void rap() {
        System.out.println("Now this is the story all about how");
        System.out.println("My life got flipped turned upside-down");
    }
}

Hasil source code di atas adalah sebagai berikut:

No comments:

Post a Comment

Odoo 11 - Create a new sample module

How To Create or Develop a Custom Module in Odoo 11 In this blog, we‘ll be focusing on how we can create or develop a custom mo...