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 a vector in java?
What are multiple inheritances?
What is thread pool? How can we create thread pool in java?
Can static method access instance variables ?
How does the garbage collector works in java?
What is the this keyword?
What does += mean coding?
What is the purpose of tostring() method in java?
What is the function of http?
What are examples of modifiers?
What is constructor chaining and how is it achieved in java?
What is meant by binding in rmi?
Can a variable be local and static at the same time?
How many boolean functions are there?
What is java util hashmap?