how to print the below in java?
* *
* *
*
* *
* *
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / kickme
public static void main (String arg[]) {
System.out.println(" * * ");
System.out.println(" * * ");
System.out.println(" * ");
System.out.println(" * * ");
System.out.println(" * * ");
}
Is This Answer Correct ? | 3 Yes | 1 No |
How to write custom exception in java?
How can u increase the heap size in the memory?
Is it possible to declare abstract class as final?What happens if we do so?
Is it possible to use string in the switch case?
What is nested loop? What is dangling else condition in it?
What is busy spin, and why should you use it?
Write a method to check if input string is palindrome?
What is the main purpose of serialization in java?
what are literals in java?
whats the difference between == and .equal ?
What is a vararg?
Is map ordered in java?