Today we are going to write a little code to make our girlfriend happy ;
After all, we programmers are not romantic enough , So we should make use of our knowledge and do it with heart ;
Knowledge involved ：
（1） Definition of function ;
（2） Function call ;
（3） Loop statement , The design of conditional sentence ;
（4） The use of two dimensional array ;
okay , Upper code ;
import java.util.Scanner; public class JAVA02 { public static void main(String[
] args) { Scanner scan = new Scanner(System.in); System.out.println(" Say love to baby ");
int a = scan.nextInt(); if(a==1){ love1();// Printing L How to do it love2();// Printing O How to do it love3();
// Printing V How to do it love4();// Printing E How to do it } } // I'm using * To represent a girlfriend's name , Change the names of your girlfriends ; public static void
love1(){ int n=5; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j==0){ System.
out.print("*"); }else if(i==4){ System.out.print("* "); } else{ System.out.print
(" "); } } System.out.println(); } System.out.println("+++++++++++++"); } public
static void love2(){ int n=5; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j==
0||j==4){ System.out.print("* "); }else if((i==4||i==0)){ System.out.print("* ")
; } else{ System.out.print(" "); } } System.out.println();; } System.out.println
("+++++++++++++"); } public static void love3(){ int n = 8; for(int i = 0;i < n/
2;i++) { for(int j = 0;j < n;j++) { if(i == j) { System.out.print("*"); }else if
(j == n-1-i) { System.out.print("*"); }else { System.out.print(" "); } } System.
out.println(); } System.out.println("+++++++++++++"); } public static void love4
(){ int n=5; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j==0){ System.out.
print("* "); }else if((i==4||i==0)){ System.out.print("* "); } else if((i==2)){
System.out.print("* "); } else{ System.out.print(" "); } } System.out.println();
; } System.out.println("+++++++++++++"); } }

This is relatively simple , If you want to print more words , Study my code by myself , I believe you will do better ;

Technology
Daily Recommendation
views 4