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 Getting There Class Review

Mike Nedelko
Mike Nedelko
8,991 Points

Update for long Date in Example.java

Hi Treehouse community.

So I followed the steps in this VDO but got the following error message when adding the converted epoche time stamp into the new Date() call.

Example.java:12: error: integer number too large: 1474056577000 new Date(1474056577000)

I did a little bit of reading and it turns out that in order to let Java know that we are passing in a long variable opposed to an integer we need to add an 'l' at the end of the variable (see StackOverflow topic here: http://stackoverflow.com/questions/3757763/integer-number-too-large-error-message-for-600851475143).

I was also required to import java.util.Date again at the top of my Example.java file.

Here is what my code looks like.

import com.teamtreehouse.Treet;
import java.util.Date;

public class Example {

  public static void main(String[] args){
    Treet treet = new Treet(
      "@craigsdennis",
      "Want to be famous? Simply tweet about Java and use" +
      "the hashtag #treet. I'll use your tweet in a new " +
      "@treehouse course about data structures.",
      new Date(1474056577000l)
    );
    System.out.printf("This is a new Treet: %s %n", treet);
  }
}

Hope this helps.

M

qzhangjhu
qzhangjhu
1,289 Points

Well done bro.

Murilo de Melo
Murilo de Melo
14,456 Points

Hi there, the 'l' needs to be 'L', uppercase, I think.