java运用就是一个类又一个类。java是面向目标的言语,目标都是由类实例化而来。一个java运用,不管简略仍是杂乱,都是由若干个java类组成的。因而,关于初学者,先知道java类的组成是必要的。
java类的组成首要有3有些:数据成员、结构办法、办法成员。
首要看下边的代码,是一个简略的java类:
package com.csst.vo;
public class customer ecs_
//1.数据成员
private string custname;
private string pwd;
private integer age;
//2.结构办法
public customer() {
public customer(string custname, string pwd) ecs_
this.custname = custname;
this.pwd = pwd;
public customer(string custname, string pwd, integer age) ecs_
super();
this.custname = custname;
this.pwd = pwd;
this.age = age;
//3.办法成员
public string getcustname() ecs_
return custname;
public void setcustname(string custname) ecs_
this.custname = custname;
public string getpwd() ecs_
return pwd;
public void setpwd(string pwd) ecs_
this.pwd = pwd;
public integer getage() ecs_
return age;
public void setage(integer age) ecs_
this.age = age;
}
尚学堂最新java,人工智能python高端就业班开课中,现在报名立减1000元!
本文转载自长沙尚学堂,http://www.cssxt.com/javazx/1835.html,网站内还有名师高淇、马士兵零基础自学java视频下载哦
北京尚学堂科技有限公司湖南分公司
0731 83072091