Contoh Penggunaan Perulangan Do While dalam Java

Perulangan Do While mempunyai syntax sebagai berikut :

Do{
 
        <Block of statements>;
 
}while(<boolean condition>);

Untuk contoh penggunaannya adalah sebagai berikut :



public class DoWhileExample {
   public static void main(String[] args) {
      int i = 0;  
      do {
         System.out.println("i is : " + i);
         i++;
     }while(i <= 5);
   }
}

Selamat mencoba, semoga membantu...

1 comments - Add Yours

UX Designers Delhi mengatakan...

Very great post. I simply stumbled upon your blog and wanted to say that I have really enjoyed browsing your weblog posts. After all I’ll be subscribing on your feed and I am hoping you write again very soon!

Posting Komentar