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

Why singleton pattern is better than creating singleton class with static instance?

1001


Can a class be private or protected in java?

1065


Is null a string?

1011


What kind of variables a class can consist of?

1107


What do you mean by buffering?

1046


Can anonymous class have constructor?

1026


Can you extend singleton class?

1107


What do you mean by aggregation?

1323


What is the preferred size of a component in java programming?

1004


What 4 doubled?

989


List down the methods and interfaces of collection class in java.

985


What is tochararray in java?

942


Difference between object instantiation and construction ?

1072


What state is a thread in when it is executing?

964


Are maps ordered java?

966