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 can we make copy of a java object?
What are the advantages of arraylist over arrays?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
What is the main difference between java platform and other platforms?
What is private static class in java?
What is the difference between the synchronized() & static synchronized()?
Can you pass by reference in java?
What is UNICODE?
What technique is carried out to find out if a particular string is empty?
Can we use different return types for methods when overridden?
What is locale in java?
Does java list allow null?