------------恢复内容开始------------
package mianxiangduixiang;
public class person {//定义一个类
//在类中定义成员变量
String name = "登陆";
int age = 24;
char sex = '男';
//在类中定义成员方法
public void eat () {
System.out.println("吃火锅");
}
public void sleep(){
System.out.println("睡懒觉");
}
public void meirong(){
System.out.println("敷面膜");
}
}
public class Mytese1 {
public static void main(String[] args) {
//创建对象,将类实例化才可以调用,用new, //dl就是创建的对象
person dl = new person();
//打点调用属性,也就是成员变量,然后接收
String xingming = dl.name;
int nianling = dl.age;
char xingbie = dl.sex;
System.out.println(xingming);
System.out.println(nianling);
System.out.println(xingbie);
//接着调用person类中的功能
dl.eat();
dl.sleep();
dl.meirong();
}
}
------------恢复内容结束------------
package mianxiangduixiang;
public class person {//定义一个类
//在类中定义成员变量
String name = "登陆";
int age = 24;
char sex = '男';
//在类中定义成员方法
public void eat () {
System.out.println("吃火锅");
}
public void sleep(){
System.out.println("睡懒觉");
}
public void meirong(){
System.out.println("敷面膜");
}
}
public class Mytese1 {
public static void main(String[] args) {
//创建对象,将类实例化才可以调用,用new, //dl就是创建的对象
person dl = new person();
//打点调用属性,也就是成员变量,然后接收
String xingming = dl.name;
int nianling = dl.age;
char xingbie = dl.sex;
System.out.println(xingming);
System.out.println(nianling);
System.out.println(xingbie);
//接着调用person类中的功能
dl.eat();
dl.sleep();
dl.meirong();
}
}