We usually use the drawing tools to draw simple graphics. Today we use Java to print some simple graphics
Implement code as follows
package test;/** * * @author hanzel * @打印图形* */public class Array { public static void main(String[] args) { //打印长方形int[] a = new int[10]; for( int i = 0; I <A.Length; I ++) {for (int j = 0; j <a <a.Length; j ++) {system.out.print ("*");} System.out.println (); } System.out.println (); // Print down the right triangle int [] b = new int [10]; for (int i = 0; i <b.Length; i ++) {for (int j = 0; j <b.length-i; j ++) {system.out.print ("*");} System.out.println ();} System.out.println (); // e = new int [10]; for (int i = 0; i <e.Length; i ++) {for (int j = 0; j <i; j ++) {system.out.print ("");} for (Int m = 0; m <em <e.Length-I; m ++) {system.out.print ("*");} system.out.println ();} System.out.println (); // Print it out Parallel two -sided int [] c = new int [10]; for (int i = 0; i <c.Length; i ++) {for (int j = 0; j <i; j ++) {system.out.print ("" "" "" ");} for (int m = 0; m <c.length; m ++) {system.out.print ("*");} System.out.println ();} System.out.println (); / /Another parallel square int [] h = new int [10]; for (int i = 0; i <h.length; i ++) {for (int j = 0; j <h.length-i; j ++) {System.out.print ("");} for (int m = 0; m <h.length; m ++) {system.out.print ("*");} System.out.println ();} System .out.println (); // Print the upright triangle int [] d = new int [10]; for (int i = 0; i <d.length; i ++) {for (int j = 0; j <i <i ; j ++) {system.out.print (""*");} System.out.println ();} System.out.println (); // Print another kind of front corner triangle int [] f = new int [ 10]; for (int i = 0; I <f.length; i ++) {for (int j = 0; j <f.length-i; j ++) {system.out.print (""); int m = 0; m <i; m ++) {System.out.print ("*");} System.out.println ();} System.out.println (); // Print a straight horn trapezoidal int [] g = new int [10]; for (int i = 0; i <g.Length; i ++) {for (int j = 0; j <g.length; j ++) {system.out.print ("*") ;} for (int m = 0; m <i; m ++) {system.out.print ("*");} System.out.println ();} System.out.println (); // int [] k = new int [10]; for (int i = 0; i <k.length; i ++) {for (int j = 0; j <k.length-i; j ++) {system.out.print ("");} for (int m = 0; m <2*(i+1) -1; m ++) {system.out.print ("*");} System.out.println ();} Systemm .out.println (); // Another type of waist triangle int [] l = new int [10]; for (int i = 0; i <l.length; i ++) {for (int j = 0; j; <i; j ++) {system.out.print ("");} for (int m = 0; m <2*(l.length-i) -1; m ++) {system.out.print ("*" );} System.out.println ();} System.out.println (); // Diamond int [] o = new int [10]; for (int i = 0; I <o.length; i ++) { for (int j = 0; j <o.length-i; j ++) {system.out.print ("");} for (int m = 0; m <2*i-1; m ++) {system.out .print ("*");} System.out.println ();} for (int i = 0; i <o.length; i ++) {for (int j = 0; j <i; j ++) {system. out.print ("");} for (int m = 0; m <2*(o.length-i) -1; m ++) {system.out.print ("*");} System.out.println ();}}}
The above is all the contents of this article. This applet has strong versatility, hoping to help everyone's learning.