Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Errr..



Long x = new Long(5);
String s;
s = x.toString(3);
s = Long.toString(3);

As you suggest, lines 3 and 4 are equivalent, BUT some Java compilers will produce a warning on line 3 indicating that line 4 is the preferred way of writing it. Personally I agree and no longer ever reference a static function without using only the Class name.

Bill

At 9:50 AM -0600 1/14/06, Don Bate wrote:
A static method can be invoked from anywhere the class is visible. If the class is not explicitly specified, then it searches the enclosing scopes looking for a suitable match. Instance method require an object instance to invoke including an implicit 'this'. BTW, you _can_ invoke a static using an object instance, the class used is the class of the instance.

Don Bate
At 9:32 PM -0600 1/13/06, Michael Hall wrote:
On Jan 13, 2006, at 9:13 PM, Matt wrote:

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Re: Java Swing and Quartz (From: Brian Foster <email@hidden>)
 >Errr.. (From: Bob Irving <email@hidden>)
 >Re: Errr.. (From: Michael Hall <email@hidden>)
 >Re: Errr.. (From: "Matt" <email@hidden>)
 >Re: Errr.. (From: Michael Hall <email@hidden>)
 >Re: Errr.. (From: "Matt" <email@hidden>)
 >Re: Errr.. (From: Michael Hall <email@hidden>)
 >Re: Errr.. (From: Don Bate <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.