logo CodeStepByStep logo

nameDiamond

Language/Type: Java string parameters
Related Links:

Write a method named nameDiamond that accepts a string as a parameter and prints it in a "diamond" format as shown below. For example, the call of nameDiamond("MARTY"); should print:

M
MA
MAR
MART
MARTY
 ARTY
  RTY
   TY
    Y
Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.