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
What is the byte order of byte buffer?
What is generic type?
Why do we use string?
What is callablestatement? How you can call stored procedure to pass in parameter?
Can we have any code between try and catch blocks?
Why are lists ordered in java?
What is the size of string?
How many types of java are there?
What is difference between == equals () and compareto () method?
Does constructor creates the object ?
Give an example of call be reference significance.
What is locale in java?
Explain about join() method?
Difference between collection, collection and collections in java?
What are instance variables?