my dog learned polymorphism
The moose likes Beginning Java and the fly likes Method calling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Method calling" Watch "Method calling" New topic

Method calling

Nagesh Vu

Joined: Mar 18, 2010
Posts: 7

I am able to understand the following piece of code:

However, I have difficulty in understanding the following piece of code:

How does one decipher the following:

I understand that the execution is as follows:

which returns an object and on the returned object, getTime() is invoked.
Is my understanding correct?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

You understood well. startDate.getTime(), which calls the getTime method of the Calendar class, returns a java.util.Date object. Then the getTime method of the java.util.Date class is called, which returns a long. (I guess it would be the same to call startDate.getTimeInMillis())

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Method calling
It's not a secret anymore!