title: how to get first and last letter of every word in an arraylist in java
body: <pre><code>public static void ReadKeyWordsFile() {
  
          
          try {
  
              ArrayList&lt;String&gt; result = new ArrayList&lt;&gt;();
              File file1 = new File(&quot;./files/kywrdsOdd.txt&quot;);
              if(file1.length() == 0){
                  System.out.println(&quot;The files is empty&quot;);
              }
              else{
              Scanner scan = new Scanner(file1);
                  while (scan.hasNextLine()){
                      result.add(scan.nextLine());  
                      
                  }
              System.out.println(result);
              
              for (int counter = 0; counter &lt; result.size(); counter++) {               
                  int l = result.size() -1; 
                  System.out.println(l);
              }
              scan.close();
              }
          } catch (FileNotFoundException e) {
              //TODO: handle exception
              System.out.println(&quot;File not found&quot;);
              e.printStackTrace();
          }
      }
  </code></pre>
  <p>But this returns only the size of the array and not the words in it.
  I want to get occurence of the first and last letter from each words in the array</p>