SHARE
TWEET

Untitled

advictoriam Jan 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2.  
  3. public class Words
  4. {
  5.    /**
  6.       Returns all short words (length <= 3) in an array of words
  7.       @param words an array of strings
  8.       @return an array list containing the short words in words
  9.    */
  10.    public ArrayList<String> shortWords(String[] words)
  11.    {
  12.       ArrayList list = new ArrayList();
  13.       for(String a : words)
  14.       {
  15.          if(a.length() <= 3){list.add(a);}
  16.       }
  17.       return list;
  18.    }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top