public class MyDate{ |
private int day= 8 ; |
private int month= 8 ; |
private int year= 2008 ; |
public MyDate( int day, int month, int year){…} |
public void print(){…} |
} |
public class TestMyDate{ |
public static void main(String args[]){ |
MyDate today = new MyDate( 23 , 7 , 2008 ); //这个 today 变量 |
//就是一个引用类型的变量 |
} |
} //源代码片段来自云代码http://yuncode.net |
|