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 does bitwise or mean?

1093


What is contract between hashcode and equal method?

1056


What is anti pattern in programming?

973


What is purpose of find feature?

1084


What is return in java?

980


What is arraylist e in java?

1065


What is jvm? Why is java called the platform independent programming language?

1026


How will you serialize a singleton class without violating singleton pattern?

1967


What is the difference between logical data independence and physical data independence?

1043


What is return keyword in java?

1058


What is map and hashmap in java?

1070


Why constructor has no return type?

1099


Can we have multiple classes in a single file?

983


How to split arraylist elements in java?

1185


How to compare two strings in java program?

1058