class Person
{
String name;
static String country = "cn";
public void PersonTest(String name,String country)
{
this.name = name;
this.country = country;
}
}
class PersonTest
{
public static void main(String[] args)
{
PersonTest p = new PersonTest("sad","asd");
System.out.println(p.name+p.country);
}
}
问题:为什么在Person类中可以定义public void PersonTest(String name,String country) ,但在主函数中却不能初始化呢?
|