1. hasMoreTokens()
- while true 문 안에 사용할 때 input으로 받은 값에 대한 토큰이 존재할 때 순서대로 실행되도록 한다.
2. countTokens()
3. nextToken()
예시
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine(), " ");
String[] Input = new String[st.countTokens()];
int i =0 ;
while(st.hasMoreTokens()) {
Input[i] = st.nextToken();
i++;
}
for (String value : Input) {
System.out.println(value);
}
}
}