标签:pac cin under class dog ping generated family orm
“此方法具有构造方法的名字”
package classpackage;
public class Puppy {
public void Puppy(String name) {
System.out.println("我的小狗名字是:"+name);
}
public static void main(String[] args) { // TODO Auto-generated method stub
Puppy dognamePuppy= new Puppy();
dognamePuppy.Puppy("Tony");
}
}
你在定义一个(普通)方法,但却有着构造方法的名字。别忘了,构造方法是没有返回类型的!
package classpackage;
public class Puppy {
public void puppy(String name) {
System.out.println("我的小狗名字是:"+name);
}
public static void main(String[] args) { // TODO Auto-generated method stub
Puppy dognamePuppy= new Puppy();
dognamePuppy.puppy("Tony");
}
}
代码中 方法 处提示:This method has a constructor name
标签:pac cin under class dog ping generated family orm
原文地址:https://www.cnblogs.com/cainiaoputeng/p/11549799.html