• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write a date setter  RSS feed

 
Jorge Maldonado
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am beginning with Java and I need to develop a setter for a date.
I was told that I can write a setter like this: setDate(long elapsedTime)
How do I get the "elapsedTime" data for a given date?

Regards,
Jorge Maldonado
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Methods have two parts, in a sense.  They are defined once.  Here is an example:

This code says, "define a method call 'foo' that takes one String, calls it 'bar', and prints it to the screen.

The next part is that methods are called one or more times.  You could call Foo like this:

But you could also call it like this:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!