帮忙看看这个程序有啥问题! class Person { String name; String city; int age; public Person(String name,String city,int age) { this.name=name; this.age=age; this.city=city; } public String talk() { return "我是: "+this.name+",今年: "+this.age+"岁,来自: "+this.city; } } public class P174 { public static void main(String[]args) { Person p1=new Person("张三",25,"中国"); Person p2=new Person("李四",30,"中国"); Person p3=new Person("王五",25,"中国"); System.out.println(p1.talk()); System.out.println(p2.talk()); System.out.println(p3.talk()); } } 编译时提示说:cannot find symbol!
------解决方案--------------------
//Person p1=new Person("张三",25,"中国"); //Person p2=new Person("李四",30,"中国"); //Person p3=new Person("王五",25,"中国"); 这三句修改成这样就行了 Person p1= new Person("张三","中国",25); Person p2= new Person("李四","中国",30); Person p3= new Person("王五","中国",25);
------解决方案--------------------