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 are the different access modifiers available in java?
Is array an object in java?
What is the private method modifier?
Does A Class Inherit The Constructors Of Its Superclass?
What are methods?
Why are lists ordered in java?
What are loops in java?
How do I find and replace in word?
What is difference between public static and void?
What is the best definition for data?
Does java have extension methods?
What’s meant by anonymous class?
Can we call virtual funciton in a constructor ?
What are the features in java?
How is a variable stored in memory?