//Rewrite the above program by using static methods. // static method help you to make your code more than one time. public static void main(String[] args) { top(); middle(); lower(); top(); middle(); lower(); } public static void top() { System.out.println(" ________"); System.out.println(" / \\"); System.out.println("/ \\"); } public static void middle() { System.out.println("-\"-\'-\"-\'-\"-"); } public static void lower() { System.out.println("\\ /"); System.out.println(" \\________/"); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter