Monday, 30 November 2020

PROGRAM TO ILLUSTRATE INFINITE for LOOP IN JAVA

 // //ILLUSTRATION 1

class NULL_LOOP

{

   public static void main(String args[])

   {

       int i;

       for(i=1;i<=10;i--)

       System.out.println("Hello");

   }

}


/*

//ILLUSTRATION 2

class NULL_LOOP

{

   public static void main(String args[])

   {

       int i;

       for(i=1;;i--)

       System.out.println("Hello");

   }

}

*/

/*

//ILLUSTRATION 3

class NULL_LOOP

{

   public static void main(String args[])

   {

       int i;

       for(;;)

       System.out.println("Hello");

   }

}

*/

No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...