aspose file tools*
The moose likes Beginning Java and the fly likes final variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "final variables" Watch "final variables" New topic
Author

final variables

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
Ok, for a final variable...
If I declare it as a class member and dont assign it a variable then I can only declare it in a constructor?
Ok, if I declare it static do i have to give it a value then cause I cant seem to assign it a value anywhere else.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Hi Anthony, you can use a static initializer. See sample code below:
 
Consider Paul's rocket mass heater.
 
subject: final variables