本帖最后由 咕咕猫 于 2013-8-28 14:44 编辑
- class Person
- {
- private String name;
- private int age;
- Person(String name,int age)
- {
- this.name = name;
- this.age = age;
- }
- public void speak()
- {
- System.out.println(name+age);
- }
- }
- class Test
- {
- public static void main(String[]args)
- {
- Person p = new Person("小王",20);
- p.speak();
- }
- }
复制代码 |
|