问题描述
|
我有一个类文件名serializedObject,我想在另一个类文件中调用该类文件并使用它的方法。
我想声明该类文件已成为另一个数组要使用的数组。
然后我声明如下:
serializedObject[] setData = new serializedObject[10];
并将其用于for循环
for(int i=0; i<clientInfo.length; i++)
{
double locationX = clientInfo[i].getLocation().getX();
double locationY = clientInfo[i].getLocation().getY();
String name = clientInfo[i].getName();
double mood = clientInfo[i].getMood();
double hunger = clientInfo[i].getHunger();
double chargestate = clientInfo[i].getChargestate();
setData[i].setAll(locationX,locationY,name,mood,hunger,chargestate);
System.out.println(setData[i].getName());
}
在serializedObject类中,我有set方法和get方法,
但似乎对此不起作用。除了该方法,我还可以做什么?
感谢您的任何评论和帮助。
系统似乎无法真正将我的价值设置为方法,
我无法从中获得任何价值
System.out.println(setData[i].getName());
但系统没有任何编译错误。
这是我的serializedObject类文件
public class serializedObject
{
public static double locationX;
public static double locationY;
public static String name;
public static double mood;
public static double hunger;
public static double chargestate;
public serializedObject()
{
}
public void setAll(double locationX,double locationY,String name,double mood,double hunger,double chargestate)
{
this.locationX = locationX;
this.locationY = locationY;
this.name = name;
this.mood = mood;
this.hunger = hunger;
this.chargestate = chargestate;
}
public String getName()
{
return this.name;
}
public double getLocationX()
{
return this.locationX;
}
public double getLocationY()
{
return this.locationY;
}
public double getMood()
{
return this.mood;
}
public double getHunger()
{
return this.hunger;
}
public double getChargestate()
{
return this.chargestate;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)