错误: 在类 中找不到主方法, 请将主方法定义为: public static void main(String[ 5
classPersonDemo{privateStringname;privateintage;privateStringlike;publicPersonDemo(St...
class PersonDemo{
private String name;
private int age;
private String like;
public PersonDemo(String n,int a,String l){
this.setName(n);
this.setAge(a);
this.setLike(l);
}
public String print(){
return "姓名:"+getName()+
"年龄:"+getAge()+
"爱好:"+getLike();
}
public void setName(String n){
name=n;
}
public void setAge(int a){
age=a;
}
public void setLike(String l){
like=l;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public String getLike(){
return like;
}
}
public class Person {
public static void main(String args[]){
PersonDemo per1=new PersonDemo("Docter",99,"playing dota");
PersonDemo per2=new PersonDemo("Man",99,"watching movie");
System.out.println(per1.print());
System.out.println(per2.print());
}
} 展开
private String name;
private int age;
private String like;
public PersonDemo(String n,int a,String l){
this.setName(n);
this.setAge(a);
this.setLike(l);
}
public String print(){
return "姓名:"+getName()+
"年龄:"+getAge()+
"爱好:"+getLike();
}
public void setName(String n){
name=n;
}
public void setAge(int a){
age=a;
}
public void setLike(String l){
like=l;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public String getLike(){
return like;
}
}
public class Person {
public static void main(String args[]){
PersonDemo per1=new PersonDemo("Docter",99,"playing dota");
PersonDemo per2=new PersonDemo("Man",99,"watching movie");
System.out.println(per1.print());
System.out.println(per2.print());
}
} 展开
1个回答
展开全部
public class Person {
public static void main(String args[]){
PersonDemo per1=new PersonDemo("Docter",99,"playing dota");
PersonDemo per2=new PersonDemo("Man",99,"watching movie");
System.out.println(per1.print());
System.out.println(per2.print());
}
}
新握凯或建孙袭个文件 命名为Person把段伍代码剪切过去就行了.
public static void main(String args[]){
PersonDemo per1=new PersonDemo("Docter",99,"playing dota");
PersonDemo per2=new PersonDemo("Man",99,"watching movie");
System.out.println(per1.print());
System.out.println(per2.print());
}
}
新握凯或建孙袭个文件 命名为Person把段伍代码剪切过去就行了.
来自:求助得到的回答
TableDI
2024-07-18 广告
2024-07-18 广告
`VLOOKUP` 匹配出错误的数据通常是由于以下几个原因:1. **查找值错误**:输入的查找值与数据源中的值不匹配,可能是因为拼写错误、大小写不一致或存在不可见的字符。2. **查找区域设置错误**:查找区域的首列必须包含要查找的值,且...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询