Bingkai Bintang ==>Java with Swing


import javax.swing.*;

class Bingkai2

{

public static void main (String[] args)

{

int n = Integer.parseInt(JOptionPane.showInputDialog(null,”Masukkan jumlah bingkai!”));

for (int i=1;i<=n ;i++ )

{

bingkai();

}

}

public static void bingkai ()

{

int i,j;

for (i=1;i<=4 ;i++ )

{

if ((i==1) || (i==4))

{

for (j=1;j1) && (i<4))

{

System.out.print("*");

for (j=1;j<=2 ;j++ )

{

System.out.print(" ");

}

System.out.print("*");

}

System.out.print("\n");

}

}

}

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