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

Can we use string in the switch case?

577


What is boolean strategy?

628


What is return keyword in java?

562


Explain the meaning of java applet.

606


Explain the transient field modifier?

565






What is entry set in java?

539


What is flag in java?

535


Explain how can you debug the Java code?

591


what is static import in java? Explain

555


Explain the difference between static and dynamic binding in java?

545


What is use of inner class in java?

516


What is the difference between and ?

514


Is array passed by reference in java?

582


Why is it called buffering?

585


What does exclamation mean in java?

575