내가 뭘 하려는지는 파일을 읽은 후 StringBuilder
을 사용하여 문자열 단어의 줄 안에있는 파일의 순서를 뒤집습니다. while 루프에서 작업 할 수있게되었지만 메서드에 추가하면 원본 파일 텍스트가 출력됩니다.자바 메서드 실행 취소 알고리즘
다음은 작동하는 코드입니다. 여기에 인쇄
line. this reads it hope I file. this read will program This
// File being read....
while ((currentString = s.next()) != null) {
a.insert(0, currentString);
a.insert(0," ");
}
이 작동하지 않습니다 코드입니다;
// File being read....
while ((currentString = s.next()) != null) {
System.out.print(reverse(currentString));
}
방법
public static StringBuilder reverse(String s){
StringBuilder a = new StringBuilder();
a.insert(0, s);
a.insert(0," ");
}
인쇄 내가 잘못 뭐하는 거지
This program will read this file. I hope it reads this line.
?