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
How to split arraylist elements in java?
What is Applet Stub Interface ?
What are the advantages of java over C++?
How to sort array in descending order in java?
Can you sort a string in java?
Explain the difference between abstraction and encapsulation.
Can we override final method?
What is size_t?
Explain the private protected method modifier?
Do loops java?
What are heterogeneous objects?
What is the use of arraylist class in java?
What is a literal coding?
State the significance of public, private, protected class?
What is an enumeration?