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 / 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


Please Help Members By Posting Answers For Below Questions

What is the byte order of byte buffer?

947


What is generic type?

974


Why do we use string?

966


What is callablestatement? How you can call stored procedure to pass in parameter?

977


Can we have any code between try and catch blocks?

927


Why are lists ordered in java?

960


What is the size of string?

1004


How many types of java are there?

923


What is difference between == equals () and compareto () method?

978


Does constructor creates the object ?

977


Give an example of call be reference significance.

981


What is locale in java?

963


Explain about join() method?

901


Difference between collection, collection and collections in java?

953


What are instance variables?

1032