Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Re: No late binding for static methods

843789May 20 2009 — edited May 20 2009
Only the sale class has a showAdvertisement() method.

When the compiler compiles that class it decides at compile time which exact method is called for each static method call (that's the big difference to non-static method calls: the exact method to be called is only decided at runtime in those cases).

There's only one method showAdvertisement() and that is called in both cases in your code. Since that single method always calls the same static announcement() method, you will see the result you posted.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 17 2009
Added on May 20 2009
15 comments
1,143 views