본문 바로가기

IT칼럼/JAVA

StringTokenizer example

//import java.io.*;
import java.util.*;

public class Main {
public static void main(String[] args) {
String example = "Jackson 23232 true";
StringTokenizer stk = new StringTokenizer(example);

String str1 = stk.nextToken();
Integer int1 = Integer.parseInt(stk.nextToken());
boolean bl1 = Boolean.parseBoolean(stk.nextToken());

if(bl1) {
System.out.println(str1);
System.out.println(int1);
} else {
System.out.println("Invalid String...");
}
}
}


'IT칼럼 > JAVA' 카테고리의 다른 글

BigInteger, BigDecimal example  (0) 2018.11.04
Priority Queue  (0) 2018.11.03
StringBuilder example  (0) 2018.11.03
BufferedReader example  (0) 2018.11.02
Scanner example  (0) 2018.11.02