构造函数与类的方法有什么区别

      我的日志 2007-10-9 10:54
一个类就好象是一个名词,比如"蛋羔"

一个构造方法,就好象是做蛋羔的模型.

每个可以吃的实体蛋羔都是通过构造方法做出来的.

A a=new A();

a就是你做来的蛋羔,

如果你想在蛋羔里加点"奶油"就是这样.
String pp="pp";

A a=new A(pp);

而方法是你的动作,比如,吃蛋羔
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}