Results 1 to 2 of 2
  1. #1
    hqt
    hqt is offline Member
    Join Date
    Nov 2011
    Posts
    27
    Rep Power
    0

    Question Const vs Final Variable

    I have searched and see that Java doesn't have constant. But, a "final variable" cannot change its value, so does it equivalent with const ?
    thanks :)

  2. #2
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default Re: Const vs Final Variable

    Final primitive types cannot have their values changed throughout the execution of the program. final objects cannot be reassigned to another object. final classes cannot be subclassed and final methods cannot be overridden by subclasses.

    The const in Java is just a reserved keyword.

Similar Threads

  1. Assign a value to a final variable
    By yma16 in forum New To Java
    Replies: 6
    Last Post: 05-08-2011, 05:27 AM
  2. Final variable-constructor method.
    By D4rkNrG in forum New To Java
    Replies: 9
    Last Post: 10-13-2010, 12:18 PM
  3. about Final variable
    By Ramanjaneyulu in forum Advanced Java
    Replies: 6
    Last Post: 08-17-2010, 10:49 AM
  4. Replies: 2
    Last Post: 12-05-2009, 12:24 PM
  5. [SOLVED] is final class members are also final ?
    By haoberoi in forum New To Java
    Replies: 4
    Last Post: 11-10-2008, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •