how to print the below in java?
* *
* *
*
* *
* *

Answers were Sorted based on User's Feedback



how to print the below in java? * * * * ..

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

how to print the below in java? * * * * ..

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

Post New Answer

More Core Java Interview Questions

what is daemon thread and which method is used to create the daemon thread? : Java thread

0 Answers  


Why do inner class cannot have static declaration except static nested class?

2 Answers   TCS, Wipro,


Can Exception handling we can handle multiple catch blocks?

0 Answers   PUCIT,


What is map in java?

0 Answers  


What is difference between static and abstract class?

0 Answers  


What is finally and finalize in java?

0 Answers  


What is a treemap in java?

0 Answers  


What are the principle concepts of oops?

0 Answers  


What is string :: npos?

0 Answers  


What is the static variable?

0 Answers  


How many types of methods are there in java?

0 Answers  


What is balanced tree in java?

0 Answers  


Categories