Java code for getting the following patterns:
Method receives String array with input String XYZ combinations and an integer varaible for the size of the String to be displayed.
X,Y,Z size=3
* *
*
* *
* *
*
*
***
*
*
***
XYZ, size=7
* *
* *
*
* *
* *
* *
* *
*
*
*
*****
*
*
*
*****
XYZ, Size=9
* *
* *
* *
*
* *
* *
* *
* *
* *
* *
*
*
*
*
*******
*
*
*
*
*******
Java code:
Method receives String array with input String XYZ combinations and an integer varaible for the size of the String to be displayed.
X,Y,Z size=3
* *
*
* *
* *
*
*
***
*
*
***
XYZ, size=7
* *
* *
*
* *
* *
* *
* *
*
*
*
*****
*
*
*
*****
XYZ, Size=9
* *
* *
* *
*
* *
* *
* *
* *
* *
* *
*
*
*
*
*******
*
*
*
*
*******
Java code: