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
Can we write a class without main method in java?
How many functional interfaces does java 8 have?
Is math an abstract class in java?
Why super is first line in java?
what do you mean by classloader in java?
What is type conversion in java?
Java Compiler is stored in JDK, JRE or JVM?
How do you sort in descending order in java using collections sort?
What do you mean by inner class in java? Explain
List the different types of classloaders in java.
What is var keyword ?
Explain about transient variables in java?
Does collectionutils isempty check for null?
Is java still relevant?
What is the difference between the boolean & operator and the && operator in java programming?