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
Why singleton pattern is better than creating singleton class with static instance?
Can a class be private or protected in java?
Is null a string?
What kind of variables a class can consist of?
What do you mean by buffering?
Can anonymous class have constructor?
Can you extend singleton class?
What do you mean by aggregation?
What is the preferred size of a component in java programming?
What 4 doubled?
List down the methods and interfaces of collection class in java.
What is tochararray in java?
Difference between object instantiation and construction ?
What state is a thread in when it is executing?
Are maps ordered java?