SSD3 全部练习和答案原创参考


SSD3 全部练习和答案(原创) 值得参考 2009年12月做的,当时都能运行!
资源截图
代码片段和文件信息
/*!Begin Snippet:file*/
import java.util.*;

public class CountTokensDemo  {

    public static void  main(String[]  args) {

String line = “this isatest“;
StringTokenizer st = new StringTokenizer(line “ “); // the second para is a string. 

//String str = null;       // this is a null string will print null
String str = ““; // this is a empty string
//String str;  // this will not compile

int count = 0;
while (st.countTokens() !=0 ) {  // counTokens() decrease the count 
//each time nextTokens() is called

str = str + st.nextToken();  // programm will hange if we 
//comment out this line.
count++;


System.out.println(str + “ “ + count);
    }
}
/*!End Snippet:file*/

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)