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
Give me example of derived data types.
What is a java predicate?
Explain how can you debug the Java code?
What is the difference between assignment and initialization?
What is return null in java?
Difference between arraylist and hashset in java?
What is a buffer in java?
how would you implement a thread pool? : Java thread
How do you use compareto in java?
What is the meaning of variable in research?
What is difference between iterator and enumeration in java?
what is static import in java? Explain
String class is defined under which package in java?
What is broken and continue statement?
What do you mean by an interface in java?