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

What is the hashcode () and equals () used for?

986


What is an empty class? What functionality does it offer in Java?

1225


Differences between external iteration and internal iteration?

1119


What does it mean that a class or member is final?

961


How to create a fecelet view?

963


What is canonical name in java?

1075


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

976


What does the “static” keyword mean?

1073


Can a final variable be null?

985


Is an integer an object?

922


Can a static method be final?

1029


Write a program to print count of empty strings in java 8?

960


What is close method? How it's different from Finalize & Dispose?

1018


what are the methods in object?

1114


What is the difference between a loader and a compiler?

995