📄 enhanc~2.jav
字号:
import java.util.Scanner;
public class EnhancedStringTokenizerDemo
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter a sentence:");
String sentence = keyboard.nextLine( );
EnhancedStringTokenizer wordFactory =
new EnhancedStringTokenizer(sentence);
System.out.println("Your sentence with extra blanks deleted:");
while (wordFactory.hasMoreTokens( ))
System.out.print(wordFactory.nextToken( ) + " ");
System.out.println( );
//All tokens have been dispensed.
System.out.println("Sentence with each word on a separate line:");
String[] token = wordFactory.tokensSoFar( );
for (int i = 0; i < token.length; i++)
System.out.println(token[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -