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 nextint () do in java?

552


How to check if linked list contains loop in java?

457


Which of the classes will have more memory allocated?

534


Can I use % with real numbers?

559


What is java util?

537






How many bytes is a string in java?

529


How to provide security in java

1802


What is meant by final class?

564


Why collection is called framework in java?

538


How many types of the indexof method are there for strings?

487


How to perform binary search in java?

570


What is the difference between form & report?

588


Can we synchronize static methods in java?

600


Can we clone singleton object?

557


What is factor r?

520