. [Method 1] In the Main class, write a static void method to print the following text by
making use of a loop. Solutions without a loop will receive no credit.
output should look like this:
1: All work and no play makes Jack a dull boy.
2: All work and no play makes Jack a dull boy.
3: All work and no play makes Jack a dull boy.
4: All work and no play makes Jack a dull boy

Answer :

MrRoyal

Answer:

The method is as follows:

static void printt() {

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

           System.out.println(i+": All work and no play makes Jack a dull boy.");

       }

   }

Explanation:

This line defines the method

static void printt() {

This line iterates through 1 to 4

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

This line prints the required output

           System.out.println(i+": All work and no play makes Jack a dull boy.");

       }

   }

Other Questions