This code will show a message written with '*' asterisks. You can do whatever message you want once you understand how the program flows. Just compile it and you' ll see.
public class LoveLetter {
public static void main(String[] args) {
method1();
method2();
method3();
}
static void method3() {
System.out.println("\n");
for(int i=0; i < 3; i++){
System.out.print("\t\t\t\t\t\t");
for(int j=0; j<9; j++){
if(j==0 || j==8){
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
System.out.print("\t\t\t\t\t\t");
for(int i=0; i<8; i++){
if(i==0 || (i>=2 && i<=6)){
System.out.print(" ");
}
else if( i==1 || i==7){
System.out.print("*");
}
}
System.out.print("\n\t\t\t\t\t\t");
for(int i=0; i<6; i++){
if((i>=0 && i<=2) || (i==4)){
System.out.print(" ");
}
else if((i==3) || (i==5)){
System.out.print("*");
}
}
}
static void method2() {
System.out.printf("\t\t\t");
for(int i=0; i<7; i++){
if(i == 0 ){
System.out.print(" ");
}
else {
if( i>=1 && i<=3){
for(int j=0; j<1; j++){
System.out.print("*");
}
if(i == 3){
for(int k=0; k<3; k++){
System.out.print(" ");
}
}
}
if( i>=4 && i<=6){
for(int j=0; j<1; j++){
System.out.print("*");
}
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<11; i++){
if(i == 0){
System.out.print("*");
}
else {
if (i >= 1 && i<= 4){
System.out.print(" ");
}
else if( i==5){
System.out.print("*");
}
else if (i >= 6 && i<= 9) {
System.out.print(" ");
}
else {
System.out.print("*");
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<11; i++){
if(i == 0){
System.out.print("*");
}
else {
if (i >= 1 && i<= 9){
System.out.print(" ");
}
else {
System.out.print("*");
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<10; i++){
if(i == 0){
System.out.print(" ");
}
else {
if(i == 1){
System.out.print("*");
}
else if(i >= 2 && i <= 8){
System.out.print(" ");
}
else {
System.out.print("*");
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<8; i++) {
if (i >= 0 && i <= 2) {
System.out.print(" ");
}
else {
if (i == 3){
System.out.print("*");
}
else if(i >= 4 && i<=6){
System.out.print(" ");
}
else {
System.out.print("*");
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<7; i++){
if (i >= 0 && i <= 3) {
System.out.print(" ");
}
else {
if (i==4){
System.out.print("*");
}
else if(i==5){
System.out.print(" ");
}
else{
System.out.print("*");
}
}
}
System.out.println();
System.out.printf("\t\t\t");
for(int i=0; i<6; i++){
if(i>=0 && i<=4){
System.out.print(" ");
}
else {
System.out.print("*");
}
}
}
static void method1() {
System.out.print(" ");
for(int i=0; i<7; i++){
if(i == 0) {
for(int j=0; j<7; j++){
System.out.print("*");
}
}
else {
System.out.print(" ");
if(i == 5){
for(int j=0; j<7; j++){
System.out.print("*");
}
}
else {
if (i < 5) {
for(int j=0; j<1; j++){
System.out.print(" *");
}
}
}
} System.out.println();
}
}
}