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 mutable object and immutable object?
Give the hierarchy of inputstream and outputstream classes.
What do you mean by chromounits in java8?
What is immutability in java?
How many types of interfaces are there?
Explain about features of local inner class?
What are format specifiers in java?
How do you override a private method in java?
How does singleton class work?
Which variables are stored in heap?
What is null statement?
How to overcome the exception object reference not set to an instance of object?
What is the parse method in java?
Is arraylist ordered?
What is the advantage of functional interface in java 8?