Feeds:
Posts
Comments

Archive for March 3rd, 2010

Issue

Final variable is used to define constant value and reference, and can only define once. In most cases, declaring a final variable is just a matter of assigning to a primitive value or a object reference directly.  However, in some cases, declaring a final class/instance variable may be more involving especially it get assigned from method that throws Exception (eg API for database access, web access), or it may involve multiple statements. In such cases, the code may become cluttered with class helper method and dummy temporary variable that help define final variable, making the code look less elegant and harder to maintain. The following common ways of declaring a final variable in those situations might look familiar to many.

(more…)

Read Full Post »

Follow

Get every new post delivered to your Inbox.

Join 31 other followers