用于标记字符串的StringTokenizer对象
import java.util.Scanner; import java.util.StringTokenizer; /** 来 自 n o w j a v a . c o m **/ public class Main { // execute application public static void main(String[] args) { // get sentence Scanner scanner = new Scanner(System.in); System.out.println("Enter a sentence and press Enter"); String sentence = scanner.nextLine(); // process user sentence /* *来 自 时 代 J a v a 公 众 号 - nowjava.com */ String[] tokens = sentence.split(" "); System.out.printf(