my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Effects of Static Variables when Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Effects of Static Variables when" Watch "Effects of Static Variables when" New topic
Author

Effects of Static Variables when

Paul Okeke
Ranch Hand

Joined: May 16, 2009
Posts: 58
I reaaly want to the implication of calling static members of a class with an instance of such class. For example, Calendar now=Calendar.getInstance(); now.setTimeInMilis(someLongValue); now.MONTH; it gave some incorrect value but i want to know why?


OCJP 1.6
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61774
    
  67

What do you think now.MONTH should have returned?

If you think it was the month of the loaded date, then you are not correct. now.MONTH is simply a key to be passed to into method such as get() and set();


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Okeke
Ranch Hand

Joined: May 16, 2009
Posts: 58
At the begging I thought it will return the loaded Date but I found that I was long. Thanks for your concern.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Effects of Static Variables when