• Post Reply Bookmark Topic Watch Topic
  • New Topic

final variables  RSS feed

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anthony, you can use a static initializer. See sample code below:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!