标题:学的很少挖
取消只看楼主
tcboy20
Rank: 1
等 级:新手上路
帖 子:72
专家分:0
注 册:2006-3-9
 问题点数:0 回复次数:0 
学的很少挖
今天终于学到类与对象了,可是看了第一页就糊涂了
就是class定义
以前不是说开头都是 public class ,怎么很多都省去public这个公共的

class Cdade{
int year;
int month;
int day;
void SetDate(int y,int m,int d)
{
year=y;
month=m;
day=d;
}
void PrintYear()
{
System.out.println(year+","+month+","+day);
}
}
class Cdate
{
public static void main(String args[]){
Cdade di=new Cdate();
d1.SetDate(2004,10,1);
d1.PrintYear();
}
}

就象这样
2006-03-23 19:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-52345-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.256951 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved