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

Abstract Problem

Create an abstract class called AbstractProblem. That class should have the following:

  • A private variable to hold the start time.
  • A constructor that initializes the start time using System.currentTimeMillis()
  • A public method called completion that accepts a long variable that prints out the following to the console:
  • “Answer L in X seconds.”, where L is the long variable that was passed into it and X is the difference between now and the saved start time. Hint: millis need to be divided by 1000 to get seconds.
Craig Dennis
Craig Dennis
Treehouse Teacher

Do you have a start to this? I'd be glad to help out, but this sounds like homework ;)