하위 디렉토리의 파일에 텍스트를 작성하는 작업이 매우 간단합니다. 필자가 보았던 모든 자습서에서이 작업은 효과가 있지만 파일은 매번 비어 있습니다. 하위 디렉토리에 쓰지 않을 때 작동하며 예외가 발생하지 않습니다.작성자가 닫을 때 하위 디렉토리의 파일에 텍스트를 쓰지 않습니다.
public class Deck {
String name;
String cardLocation;
public Deck(String name, String cardLocation) {
this.name = name;
this.cardLocation = cardLocation;
}
public String toXml(){
StringBuilder builder = new StringBuilder();
builder.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?> \n");
builder.append("<deck> \n");
builder.append("<name> " + this.name + " </name> \n");
builder.append("<cardLocation> " + this.cardLocation + " </cardLocation> \n");
builder.append("</deck> \n");
return builder.toString();
}
public String getName() {
return name;
}
public String getCardLocation() {
return cardLocation;
}
}
당신이 그것을 디버깅을 시도 해 봤나 :
그래서 수정은 단순히
deckFile
와deckFile.getName()
를 대체하는 것입니다? 갑판에 무엇을 가지고 있습니까? –