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

Why is multithreading important?

956


What is __ init __ functions?

1140


How can we achieve thread safety in java?

1163


How many bits is a string in java?

1041


When is the garbage collection used in Java?

1214


How do you compare two objects?

953


What ide should I use for java?

1045


Can we have this () and super () together?

1057


How java uses the string and stringbuffer classes?

1084


Why does java does not support multiple inheritance? Explain

989


What is complexity in java?

1067


What is difference between iterator access and index access?

1074


What is runtime polymorphism or dynamic method dispatch?

1020


Which keyword specify that a variable is effectively final ?

1005


What is method reference?

999