一道逻辑问题,你的答案是什么


f3230a0d-0ab0-4c66-b05f-82f96e298693.jpg
已邀请:

CloudForK - Go your sister's signature.

赞同来自: changkaizhao morewell Me_TangZoe clank pistol csuldw yan alextam更多 »

    package today;

    public class Date{
        public int yestoday;
        public int today;
        public int tomorrow;
    
        public static String []day = {"Sun","Mon","Tue","Wen","Thur","Fri","Sat"};
    
        public Date (int _yestoday) {
            yestoday = (_yestoday)%7;
            today    = (_yestoday+1)%7;
            tomorrow = (_yestoday+2)%7;
        }
    
        public static void main(String[] args) {
            for(int i = 0;i<day.length;i++){
                Date real = new Date(i);
                Date expected = new Date(i+2);
                if(day[expected.today]=="Fri"){
                    System.out.println(day[real.today]);
                }
            }
        }
    }


结果是周三

该问题目前已经被锁定, 无法添加新回复