Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 are the different access modifiers available in java?

976


Is array an object in java?

903


What is the private method modifier?

1031


Does A Class Inherit The Constructors Of Its Superclass?

995


What are methods?

963


Why are lists ordered in java?

965


What are loops in java?

1156


How do I find and replace in word?

918


What is difference between public static and void?

936


What is the best definition for data?

922


Does java have extension methods?

912


What’s meant by anonymous class?

1018


Can we call virtual funciton in a constructor ?

2134


What are the features in java?

1017


How is a variable stored in memory?

932