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 the below in java?
* *
* *
*
* *
* *

Answer Posted / ganesh slv

/**
* Printing Stars - 24.03.10
* @author Ganesh
*/

public class Star {

/**
* Please Send me Your Comment - slvganesh.java@gmail.com
*/

public static void main (String arg[]) {

int n = 6;
for (int i=0, j=n; i<=n; i++,j--) {
for (int k=0; k<=n; k++) {

if (i==k || j==k)
System.out.print ("*");
else
System.out.print (" ");
}
System.out.println ();
}
} // Main
} // Class

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

1043


Does list allow duplicates in java?

880


What are the advantages of passing this into a method instead of the current class object itself?

1616


what is the difference between yielding and sleeping? : Java thread

905


What is the difference between replace and replace all?

943


What happens if we override private method?

913


What is a double?

1038


What is meant by bytecode?

963


Similarity and difference between static block and static method ?

870


Can we use static class instead of singleton?

998


Can you change array size in java?

916


What is the purpose of the system class in java programming?

1003


Can we return null in java?

1064


What is re-factoring in software?

975


What do you mean by JVM?

1007