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
Name component subclasses that support painting in java programming?
What are the important methods of java exception class?
What is the difference between keyword and identifier?
What is meant by call by reference?
What is the meaning of 3 dots in java?
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
What is autoboxing and unboxing?
What is the purpose of the finalize() method?
What do you mean by local class?
Explain about exception propagation?
What is the difference between a local variable and an instance variable?
What are some examples of variable costs?
How is a structure different from array ?
What is immutable class in java?
Explain the difference between extends thread vs implements runnable in java?