编译java报错,提示找不到符号,符号是构造函数
黎前点星 2016-11-19 09:20:16 class Xinxi
{
String name;
int age;
public static int count = 0;
public void Xinxi(String name,int age){
count++;
this.name = name;
this.age = age;
System.out.println("产生了" + count + "个对象!");
}
public void info(){
System.out.println("姓名"+this.name+",年龄"+this.age+",生成对象"+count);
}
}
public class Demo1
{
public static void main(String args[]){
Xinxi x1 = new Xinxi("zhangsan",1);
Xinxi x2 = new Xinxi("lisi",2);
Xinxi x3 = new Xinxi("wanger",3);
x1.info();
x2.info();
x3.info();
}
}