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 Java Data Structures - Retired Organizing Data Splitting Strings

Paul Joiner
Paul Joiner
1,682 Points

I can't follow along with the video. Any idea what's wrong with my code?

I'm pretty sure I'm following along with Craig exactly, but for some reason when I go to compile Example.java I get multiple errors. Does anyone have an idea about what's wrong with my code?

Paul Joiner
Paul Joiner
1,682 Points
import java.util.Date;

import com.teamtreehouse.Treet;

public class Example {

  public static void main (String [] args) {
  Treet treet = new Treet(
  "craigdennis",
  "Want to be famous? Simply tweet about Java using the hashtag #treet. I'll use your tweet in a new @tr
eehouse course about data structures.",
   new Date(1421849732000L)
  );
  System.out.printf("This is a new Treet:  %s %n", treet);
  System.out.println("The words are:");
  for (String word: treet.getWords()) {
    System.out.println("word");
  }

 }

}

2 Answers

Per Karlsson
Per Karlsson
12,683 Points

Don't forget to add a space between word and : in the for loop.