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 collatration?

1 Answers  


What is an i/o filter?

6 Answers  


Is an object null?

1 Answers  


Can we create constructor in abstract class ?

1 Answers  


Can you explain the meaning of aggregation and composition

1 Answers  


Do you need to import math in java?

1 Answers  


How is it possible for two string objects with identical values not to be equal under the == operator?

1 Answers  


what are the major differences between jdk1.4 and jdk1.5?

2 Answers   Cap Gemini, Crimson Logic, Infosys, TCS, Tenth Planet,


What is ternary operator? Give an example.

1 Answers  


How does thread synchronization occurs inside a monitor?

1 Answers  


What is the abstraction?

1 Answers  


What is the difference between preemptive scheduling and time slicing in java programming?

1 Answers  


Categories