本帖最后由 张向辉 于 2013-1-16 12:02 编辑
- package exercise5;
- public class personDemo {
- private String name;
- private int age;
- personDemo(String name){
- this.name=name;
- }
- personDemo(String n,int a){
- name=n;
- age=a;
- }
- public void speak(){
- System.out.println("name="+name+"……age="+age);
- }
- }
- class PersonDemo3{
- public static void main(String[] args) {
- personDemo p= new personDemo("lixi");
- p.speak();
- }
- }
复制代码 那里出错了呢?运行不出结果? |