大佬帮忙,谢谢!
我的程序是:import java.io.*;
public class j205
{
public static void main(String args[])
{
person5 chy = new person5(100,"chy");
chy.SetHead("咖啡黑","不是方形","黑色",57.7);
chy.theH.showHeadProperties();
}
}
interface HeadInter
{
public void showHeadProperties();
}
class person5
{
public HeadInter theH;
private int age;
public String name;
public person5(int a,String n)
{
age = a; name = n ;
}
public void SetHead(final String e,final String f,final String h,final Double s)
{
theH = new HeadInter()
{
String eye;
String face;
String hair;
Double size;
{
eye =e; face = f; hair = h;size = s;
if(age > 80)
hair = hair + ",有白发";
}
public void showHeadProperties()
{
System.out.println(name + " 的头: " + " \n眼睛: " + eye + " \n脸: " + face + " \n头发: " + hair + " \n头围: " + size);
}
};
}
}
它老报个错误 j205.java:7: SetHead(java.land.string,java.land.string,java.land.string,java.land.double )
in person5 cannot be applied to (java.land.string,java.land.string,java.land.string,java.land.double )
chy.SetHead("咖啡黑","不是方形","黑色",57.7);
^
搜索更多相关的解决方案:
大佬
----------------解决方案--------------------------------------------------------
貌似没什么问题啊...
----------------解决方案--------------------------------------------------------