java - How to call methods in the main so that they output on the same line? -


i trying construct image , want of methods come out on same line far i'm getting. can't figure out how next method called appear on same line/right next previous method. can help?

public class diamonds {     public static void main (string [] args) throws ioexception {     //calling methods put logo     triangleb(); //part of top diamond     trianglea(); //part of top diamond     trianglec(); //part of top diamond     triangled(); //part of top diamond     triangleb(); //part of bottom left diamond     drawbox(); //part of bottom left diamond     triangled(); //part of bottom left diamond     trianglec(); //part of bottom right diamond     drawbox(); //part of bottom right diamond     trianglea(); //part of bottom right diamond  }  public static void trianglea () throws ioexception {     //creates top right piece of top diamond , piece of bottom right diamond     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();     int y = fileinput.nextint();      while (y <= size) {         (int x = 0; x <= size; x++) {             if ( x <= y) system.out.print("*");             else system.out.print(" ");}         y++;         system.out.println();     } }  public static void triangleb () throws ioexception {     //creates top left piece of top diamond , piece of bottom left diamond     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();     int y = fileinput.nextint();      while (y <= size) {         (int x = size; x >= 0; x--) {             if ( x <= y) system.out.print("*");             else system.out.print(" ");}         y++;         system.out.println();     } }  public static void trianglec () throws ioexception {     //creates bottom left piece of top diamond , piece of bottom right diamond     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();     int y = fileinput.nextint();      while (y <= size) {         (int x = 0; x <= size; x++) {             if ( x >= y) system.out.print("*");             else system.out.print(" ");}         y++;         system.out.println();     } }  public static void triangled () throws ioexception {     //creates bottom right piece of top diamond , piece of bottom left diamond     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();     int y = fileinput.nextint();      while (y <= size) {         (int x = size; x >= 0; x--) {             if ( x >= y) system.out.print("*");             else system.out.print(" ");}         y++;         system.out.println();     } }  public static void drawline () throws ioexception {     //method used draw lines box     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();      (int x = 0; x < size; x++) {         system.out.print("**"); //two asterisks instead of 1 create box longer length height     }     system.out.println(); }  public static void drawbox () throws ioexception {     //method draw box bottom diamonds     scanner fileinput = new scanner(new file("config.txt"));      int size = fileinput.nextint();     int y = fileinput.nextint();      while (y <= size) {         drawline();         y++;     } } 

}

try use printf() instead of println()


Comments