package com.wzh.dbstudy;
/**
* Created by HP on 2018/1/17.
*
* @author by wangWei
*/
public class Student {
//静态的数据
String name;
int id;
int age;
String gender;
int weight;
//动态的行为
public void study() {
System.out.println(name + "在学习");
}
public void sayHello(String sname) {
System.out.println(name + "向" + sname + "say hello");
}
public static void main(String[] args) {
Student s1 = new Student();
s1.name = "学生1";
s1.study();
s1.sayHello("某人");
Student s2 = new Student();
s2.age = 18;
s2.name = "学生2";
}
}
未命名文件.png
网友评论