Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Why does my code not compile?

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;
import java.util.Arrays; 
import java.util.List; 
import com.teamtreehouse.Treet;
import com.teamtreehouse.Treets;


public class Example {

  public static void main(String[] args) {
    Treet[] treets = Treets.load();
    System.out.printf("There are %d treets. %n",
                     treets.length);
    Treet[] originalTreet = treets[0]; 
    System.out.println("Hastags"); 
    for (String hashtag: getWords.getHashTags()) {
     System.out.println(hashtag);  
    }

  }

}
package com.teamtreehouse;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays; 
import java.util.List; 
import java.util.Date;



public class Treet implements Comparable, Serializable, List {
  private static final long serialVersionUID = 7146681148113043748L;
  private String mAuthor;
  private String mDescription;
  private Date mCreationDate;

  public Treet(String author, String description, Date creationDate) {
    mAuthor = author;
    mDescription = description;
    mCreationDate = creationDate;
  }

  @Override
  public String toString() {
    return String.format("Treet:  \"%s\" by %s on %s", 
                         mDescription, mAuthor, mCreationDate);
  }

  @Override
  public int compareTo(Object obj) {
    Treet other = (Treet) obj;
    if (equals(other)) {
      return 0;
    }
    int dateCmp = mCreationDate.compareTo(other.mCreationDate);
    if (dateCmp == 0) {
      return mDescription.compareTo(other.mDescription);
    }
    return dateCmp;
  }

  public String getAuthor() {
    return mAuthor;
  }

  public String getDescription() {
    return mDescription;
  }

  public Date getCreationDate() {
    return mCreationDate;
  }

  public List<Strings> getWords() {
   String words[] = mDescription.toLowerCase().split("[^\\w#@']+"); 
      return Arrays.asList(words); 
  }

  private List<Strings> getWordsPrefixWith(String prefix) {
    List<String> results =  new ArrayList<String>();
    for (String word: getWords()) {
      if (word.startsWith(prefix)) {
        results.add(word);  
      }
    }
   return results; 
  }

 private List<Strings> getHashTags() {
   return getWordsPrefixWith("#");
  }

   public List<Strings> getMentions() {
    return getWordsPrefixWith("@");
   }




}

It's good that you shared the code (I edited it for formatting. you can mark out a code block by wrapping your code with 3 backticks (```) on the line before and after. You can pecify the language after the first set of backticks.) It would be even better to know what the compiler got hung up about so we can narrow down where the problem is.