• Post Reply Bookmark Topic Watch Topic
  • New Topic

Having trouble with imported classes  RSS feed

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing the cattle ranch projects, and the one that uses the Date class and BigInteger class are giving me trouble. The Date one wants you to return the amount of time in seconds, milliseconds, days, etc. since 1970. The default method of getTime() returns the amount of milliseconds since 1970. I don't know the format in which to use this method. I am not "new" to java, but many things in relation to proper method declaration and class relationships confuse me, so I would really appreciate some help instead of the standard, "Figure it out." This is the code I have:

 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've declared the getTime() method with the void return type in line 5. That means the method doesn't return any value. Yet, in line 11, you're printing the value that the method is supposed to return. That will obviously not work, because the method doesn't return any value.

You'll have to change the declaration in line 5 to return a type instead of void, and add code to the method with a return statement to return a value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!