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


Please Help Members By Posting Answers For Below Questions

What is mutable object and immutable object?

920


Give the hierarchy of inputstream and outputstream classes.

853


What do you mean by chromounits in java8?

741


What is immutability in java?

846


How many types of interfaces are there?

795


Explain about features of local inner class?

860


What are format specifiers in java?

838


How do you override a private method in java?

718


How does singleton class work?

771


Which variables are stored in heap?

803


What is null statement?

798


How to overcome the exception object reference not set to an instance of object?

918


What is the parse method in java?

825


Is arraylist ordered?

812


What is the advantage of functional interface in java 8?

793