class Text06 { public static void main(String[] args) { Person p = new Person(); p.name = "张三"; p.age = 17; p.gender = "男"; System.out.println(p.name + " " + p.age + " " + p.gender); p.studay(); p.sleep(); } } class Person { String name; int age; String gender; public void studay(){ System.out.println("学习"); } public void sleep(){ System.out.println("睡觉"); } } |