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

    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
    Waterford, Ireland
    Rep Power

    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, 04:27 AM
  2. Final variable-constructor method.
    By D4rkNrG in forum New To Java
    Replies: 9
    Last Post: 10-13-2010, 11:18 AM
  3. about Final variable
    By Ramanjaneyulu in forum Advanced Java
    Replies: 6
    Last Post: 08-17-2010, 09:49 AM
  4. Replies: 2
    Last Post: 12-05-2009, 11:24 AM
  5. [SOLVED] is final class members are also final ?
    By haoberoi in forum New To Java
    Replies: 4
    Last Post: 11-10-2008, 03: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