This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Asaf, The syntax for a constant in Java is final so you would do something like:
To make a constant called CONSTANT_NUM for your class, and set it to 10. (static final makes it a constant for every object in the class, and final by itself makes it constant just for the current object. That means you can leave out the value and assign it a value in the class constructor. Then you can't change it afterwards. That means you can make each object have a different constant if you wanted. Pretty cool , huh? ) You can find this in the JLS in section 220.127.116.11, but I would really advise getting something a little more readable as a language reference. Look in the JavaRanch Bunkhouse for some suggestions. HTH, -Nate [This message has been edited by Nathan Pruett (edited March 16, 2001).]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Mar 08, 2001
will this work for a final int array : int m = 2; final int array = new int; array = m;