这是什么意思
时间:2008-06-11 08:21:48
来源:论坛整理 作者: 编辑:chinaitzhe
public class student(){....}
public class studentDAO{
public student findstudent(string usename,string password){......}}
请问后面这句定义的是student的类函数?后面这句定义的是一个新类还是一个函数啊?我是新手,请告诉我一下,谢谢
网友回复:studentDAO是一个新类 里面有个findstudent方法 studentDAO是对有关student类的操作封装. 例如在数据库中查找 删除 更新 添加student实体,都封装在studentDAO中
当然这2个类都是public的 不能定义在一个文件中
DAO:data access object
网友回复:
- Java code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ public class student(){....}//定义了一个类: student public class studentDAO{//又定义了一个类:studentDAO public student findstudent(string usename,string password){......}//此处定义了一个函数。 }
网友回复:
- Java code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ public class student(){....} public class studentDAO{ public student findstudent(string usename,string password){......}}//定义一个函数,返回值类型是一个Student对象
网友回复:
网友回复:public class student(){....} //定义了一个student类
public class studentDAO{ //定义了一个studentDAO类
public student findstudent(string usename,string password){......}
//这就是一个函数啊!但是返回的是student类的对象(返回类型,换成int你可以理解,不一样吗?)
}
//提示:类名规范的写法是第一个字母大写啊!
网友回复:studentDAO通常用于封装对数据库的操作,findstudent(string usename,string password)方法用于通过参数从数据库中查找对应的记录返回对应的对象
关键字:意思,
上一篇:修饰符怎么添加啊
下一篇:下面没有链接了











文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面