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 create an immutable class?
What type of value does sizeof return?
How to find the length and capacity of a string buffer ?
What if I write static public void instead of public static void in java?
How to split arraylist elements in java?
What is difference between compatible and incompatible changes in serialization?
Whats the difference between notify() and notifyall()?
Distinguish between a predicate and a function?
In the below example, how many string objects are created?
Which class is extended by all other classes?
What is the use of static import ?
What is Mutex (Mutual Exclusion Object) ?