java问题 无法将类 中的构造器 应用到给定类型
这是代码,求大神解答!classPlus{privateintx,y,z;privatedoublem,n;publicPlus(){}publicintPlus(int...
这是代码,求大神解答!
class Plus
{
private int x,y,z;
private double m,n;
public Plus(){}
public int Plus(int a,int b)
{
x=a;y=b;
return x+y;
}
public int Plus(int a,int b,int c)
{
x=a; y=b; z=c;
return x+y+z;
}
public double Plus(double a,double b)
{
m=a; n=b;
return m+n;
}
}
public class P1
{
public static void main(String[] args)
{
int m=3,n=5,z=7;
double x=3,y=5;
Plus a=new Plus();
Plus b=new Plus(m,n);
Plus c=new Plus(m,n,z);
Plus d=new Plus(x,y);
}
} 展开
class Plus
{
private int x,y,z;
private double m,n;
public Plus(){}
public int Plus(int a,int b)
{
x=a;y=b;
return x+y;
}
public int Plus(int a,int b,int c)
{
x=a; y=b; z=c;
return x+y+z;
}
public double Plus(double a,double b)
{
m=a; n=b;
return m+n;
}
}
public class P1
{
public static void main(String[] args)
{
int m=3,n=5,z=7;
double x=3,y=5;
Plus a=new Plus();
Plus b=new Plus(m,n);
Plus c=new Plus(m,n,z);
Plus d=new Plus(x,y);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询