vendredi 29 janvier 2021

Why "Saturday" keep showing in the output?

import java.util.*;

//Compiler version JDK 11.0.2

public class Excercise {
public static void main(String[] args) {
        
    String []day = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
    for (int i=0; i<day.length; i++) {
        if (i==5) {
    System.out.println("Free Time"); }
         
        if (i==6) {
    System.out.println("Family Time"); }
    
        else {
    System.out.println(day[i]); }
        

    }
  }
}

Aucun commentaire:

Enregistrer un commentaire