1.类
类的概念:是一个模板,描述一类对象的行为和属性的集合。
类包括:属性、方法、构造方法、(块、内部类)。
[访问权限修饰符][修饰符]class 类名(首字母大写){
类体
}
e.g public class Person{

}
2.重载
构成重载的条件:
1.函数/方法名:相同
2.参数类型:不同
3.参数顺序:不同
4.参数个数:不同
5.如果只有返回值不同,是不能构成重载。
e.g void sum (int a,int b)
int sum (float a,float b)
int sum (int a,float b)
3.小小例: public class text {

public static void main(String[] args) {
// TODO Auto-generated method stub

sCar ycar=new sCar();

System.out.println("车牌号:"+ycar.number);
ycar.pl();
System.out.println("车的颜色:"+ycar.color);
System.out.println("车的品牌:"+ycar.from);
}
}
class sCar{
String number ="986AF3";
String color = "白色";
String from = "大众";

void pl() {
System.out.println("很多人使用这款车");
}
}

显示结果:

车牌号:986AF3
很多人使用这款车
车的颜色:白色
车的品牌:大众