LogicElement 是个保存内容的类 public LogicElement[] initPAnDArch(){
LogicElement[] le = new LogicElement[LENUM];
int[] tempCcab = new int[LECCABNUM];
int[] tempScab = new int[LESCABNUM];
String[] tempInput = new String[LEINPUTNUM];
String[] tempOutput = new String[LEOUTPUTNUM];
for(int i = 0; i < LENUM; i++){
le[i] = new LogicElement();
le[i].setCarryIn(null);
le[i].setCarryOut(null);
le[i].setClock(null);
le[i].setCcabIndex(tempCcab);
le[i].setScabIndex(tempScab);
le[i].setInput(tempInput);
le[i].setOutput(tempOutput);
le[i].setCarryIn(null);
le[i].setCarryOut(null);
}
return le;

}用以上办法初始化后  内容还在  如何恢复到null 指向空?

解决方案 »

  1.   

    public class LogicElement {
        private String carryIn;
        private String shiftIn;
        private String clock;
        private int[] ccabIndex;
        private int[] scabIndex;
        private String[] input;
        private String[] inter;
        private String[] output;
        private String carryOut;
        private String shiftOut;
        private String[] configData;
        private boolean used;
    }
      

  2.   

    不明白楼主的意思,把什么恢复到null?
      

  3.   

    就是 我所有string 都是null  现在存东西了  如何再初始化成null还有int 如何也初始化   我要反复调用的  但每次都要把内容全部清空
      

  4.   

    le[i] = new LogicElement();
    le[i].setCarryIn(null);
    le[i].setCarryOut(null);
    le[i].setClock(null);
    le[i].setCcabIndex(tempCcab);
    le[i].setScabIndex(tempScab);
    le[i].setInput(tempInput);
    le[i].setOutput(tempOutput);
    le[i].setCarryIn(null);
    le[i].setCarryOut(null);实在不明白你的setNULL有什么用,你不set它本身也是NULL。
      

  5.   


    你new出来的这个对象,本身就不是你已经存东西的对象,重新设置已经存数据那个对象不叫初始化吧。
    int的初始化,随便set个1或者0或者其他。
    你或者应该把你那个 LogicElement的数据传进来,再重置它。
      

  6.   

    int[] tempCcab = new int[LECCABNUM];
    int[] tempScab = new int[LESCABNUM];
    String[] tempInput = new String[LEINPUTNUM];
    String[] tempOutput = new String[LEOUTPUTNUM];
     以上定义并初始化的数组变量都是方法内的局部变量,方法结束后都不存在了。怎么调用啊?
      

  7.   

    你只需要把每次new出来的对象重新赋值就行了,不需要初始化null