What is the exact output of the following program Show your

What is the exact output of the following program? Show your import Java. util. *; public class Numbers {public static void main {String [] args} {int i = 1; while (i

Solution

Program :

import java.util.*;
public class Numbers
{
public static void main(String[] args)
{
int i=1;
while(i<5)
{
myMethod(2+i,i);
i=+1;
}
}
public static void myMethod(int A, int num)
{
for( int k=1; k<=A;k++)
{
System.out.println(num + \" \");
num=num+1;
}
System.out.println();
}
}

Output :The above proigram gives infinite loop

1

2

3

1

2

3

1

2

3

1

2

3

.

.

.

.

.

.

and so on

 What is the exact output of the following program? Show your import Java. util. *; public class Numbers {public static void main {String [] args} {int i = 1; w
 What is the exact output of the following program? Show your import Java. util. *; public class Numbers {public static void main {String [] args} {int i = 1; w

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site