集册 Java实例教程 对象作为函数参数和返回结果

对象作为函数参数和返回结果

欢马劈雪     最近更新时间:2020-01-02 10:19:05

484
对象作为函数参数和返回结果

class Date {/*nowjava.com - 时  代  Java*/

  int dd;

  int mm;

  int yyyy;


  static final String[] months = { "January", "February", "March", "April", "May", "June", "July", "August",

      "September", "October", "November", "December" };


  // Constructor

  Date(int day, int month, int year) {

    this.dd = day;

    this.mm = month;

    this.yyyy = year;

  }


}
/** 来 自 时代Java公众号 - nowjava.com**/

public class Main {


  static void Display(Date day) {

    System.out.println("Date:" + day.dd + "/" + day.mm + "/" + day.yyyy);

  }


  public 
展开阅读全文