I'm a beginner, and I was wondering how to write a java code for this:

*
***
*****
*******
*****
***
*

I'm using DrJava. This is supposed to be in a diamond formation. Hopefully it posts that way.

Thank you :)

Recommended Answers

All 4 Replies

by doing your own homework and research. This question has been asked and answered a million times before.
Only the exceptionally lazy and exceptionally incompetent will be unable to by now find the answer, and they don't deserve the answer.

this is supposed to be for help.

We don't get anything for helping you, so when you ask questions that waste our time, you usually get mean or sarcastic responses. If you get a response at all.

See http://lmgtfy.com/?q=draw+a+diamond+java

This is supposed to be in a diamond formation. Hopefully it posts that way.

No, it doesn't post correctly. You need to use code tags.

*
    ***
  *****
*******
  *****
    ***
      *

And it still won't display correctly (see above) since you need to use a Courier font when you design it. Design it in a word processor in Courier font, then copy and paste here using code tags.

[code=text] // diamond goes here.

[/code]
You need to use a loop within a loop and you need to display spaces, asterisks, and newlines within the loops, a character at a time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.