zoukankan      html  css  js  c++  java
  • accessor method & mutator method

    import java.time.*;
    
    public class MyTest{
        public static void main(String[] args){
            LocalDate date = LocalDate.now();
            int month = date.getMonthValue();
            int today = date.getDayOfMonth();
    
            date = date.minusDays(today - 1);
            DayOfWeek weekday = date.getDayOfWeek();
            int value = weekday.getValue();
    
            System.out.println("Mon Tue Wed Thu Fri Sat Sun");
            for(int i = 1; i < value; i ++)
                System.out.print("    ");
            while(date.getMonthValue() == month){
                System.out.printf("%3d", date.getDayOfMonth());
                if(date.getDayOfMonth() == today)
                    System.out.print("*");
                else
                    System.out.print(" ");
                date = date.plusDays(1);
                if(date.getDayOfWeek().getValue() == 1) System.out.println();
            }
            if(date.getDayOfWeek().getValue() != 1) System.out.println();
        }
    }
     date = date.minusDays(today - 1); 更改了 date 所引用的对象
  • 相关阅读:
    对象的方法
    uni-app运行
    flex取值
    阿里矢量库使用
    移动端vue项目模板
    微信分享--转载
    页面流动条
    uni-app打包
    Hibernate~DAO
    EL表达式
  • 原文地址:https://www.cnblogs.com/xkxf/p/6166324.html
Copyright © 2011-2022 走看看