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

Why multiple inheritance is not supported by java?

0 Answers  


What does super keyword do?

0 Answers  


Is sizeof a preprocessor?

0 Answers  


How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?

0 Answers   TCS,


Does java vector allow null?

0 Answers  






What is boolean example?

0 Answers  


What is difference between filereader and bufferedreader?

0 Answers  


What is the purpose of main function in java?

0 Answers  


Tell me a few examples of final classes defined in Java API?

0 Answers   DELL,


What is indexof?

0 Answers  


What is the meaning of variables in research?

0 Answers  


When you declare a method as abstract method ?

2 Answers   HP,


Categories