SelamatDatang.java

October 30, 2009

Berikut adalah contoh berkas sederhana SelamatDatang.java

/** File SelamatDatang.java
 * @author The Petarung
 * @url: https://thepetarung.wordpress.com
 * @date 30 oktober 2009
 */

public class SelamatDatang{
    public static void main(String[] args){

        String[] ucapan = new String[3];
        ucapan[0] = "Selamat datang!";
        ucapan[1] = "Selamat berlatih Java!";
        ucapan[2] = "Semoga sukses!!";

        for (String u : ucapan)
            System.out.println(u);
    }
}


Setelah dikompilasi dan dijalankan, hasilnya adalah sebagai berikut:

Selamat datang!
Selamat berlatih Java!
Semoga sukses!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: