how to print a numbers from 1 to 100 with out using control
structures?

Answer Posted / sushila

public class Arr
{
static int a[]=new int[100];
static int i=0;
public static void main(String args[])
{
try
{
i=add(i);
a[i]=i;
main(args);
}
catch(ArrayIndexOutOfBoundsException e){

}
}
static int add(int i)
{
System.out.println(++i);
return ++i;
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name component subclasses that support painting in java programming?

833


What are the important methods of java exception class?

760


What is the difference between keyword and identifier?

793


What is meant by call by reference?

752


What is the meaning of 3 dots in java?

888


what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

734


What is autoboxing and unboxing?

769


What is the purpose of the finalize() method?

956


What do you mean by local class?

766


Explain about exception propagation?

774


What is the difference between a local variable and an instance variable?

772


What are some examples of variable costs?

724


How is a structure different from array ?

798


What is immutable class in java?

714


Explain the difference between extends thread vs implements runnable in java?

819