how to print a numbers from 1 to 100 with out using control
structures?
Answer Posted / vinodh
public class Printnos
{
static int a[]=new int[100];
static int i=1;
public static void main(String args[])
{
try
{
i=add(i);
a[i]=i;
main(args);
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println(i);
}
}
static int add(int i)
{
System.out.println(i);
return ++i;
}
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Define array. Tell me about 2-D array.
What is int short for?
what is the difference between the methods sleep() and wait()? : Java thread
Why is it called boolean?
Explain working of call by reference function invoking.
What is a static method in java?
Can java list contain duplicates?
What are the disadvantages of object oriented programming?
Why is it important to initialize a variable?
How can we avoid including a header more than once?
What is the difference between replace and replace all?
What is parsing in java?
Define a java class.
What is array class in java?
What is time complexity java?