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
What is scope of a variable?
What is serialversionuid?
What is the use of set in java?
Write java program to reverse string without using api?
Explain importance of inheritance in java?
Can we pass null as argument in java?
Explain the importance of throwable class and its methods?
Why hashmap is used in java?
Why convert an applet to an application?
How big is a boolean?
What is garbage collection? Can it be forced to run?
What is string data?
What are methods?
When should you use arraylist and when should you use linkedlist?
Is vector thread safe in java?