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
Should you use singleton pattern?
What are access specifiers in java ?
What is a flag and how does it work?
How many types of flags are there?
What does += mean coding?
What are the different types of collections in java?
Name four container classes.
Is heap stored in ram?
What are the escape sequences in java?
Is the empty set a singleton?
Which containers use a flowlayout as their default layout in java programming?
Can java list contain duplicates?
What are the four integer types supported by java?
What is meant by class loader? How many types are there?
Is nan false?