5. ข้อความ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 5-15  ส่วนของโปรแกรมอ่านคำศัพท์มาต่อกันเป็นสตริง
    Scanner in = new Scanner(new File("c:/java101/riwords.txt"));
    String riwords = "$";
    while (in.hasNext()) {
      String line = in.nextLine();
      line = line.trim();
      if (line.length() > 0 && !"#".equals(line.substring(0, 1))) {
        riwords = riwords + line + "$";
      }
    }     
©2009 S.Prasitjutrakul