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 does || || mean in math?
What is the difference between the font and fontmetrics classes in java programming?
How would you use Bubble Sort to sort the number of elements?
What is the transient keyword?
Define interface in java?
Why we used break and continue statement in java?
Can you instantiate the math class in Java?
Is null an object in java?
What is adapter in java?
What is the difference between ArrayList and Vector? which one is better in Java
Can you inherit from an abstract class java?
What is the difference between heap memory and stack memory?
Does set allows null in java?
Difference between arraylist and hashset in java?
Difference between concurrent hashmap and hashtable and collections