1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

JavaScript What is the difference between private int and final int in java scripting?

Discussion in 'Web Development' started by Anna Hussie, Apr 10, 2011.

  1. Anna Hussie

    Anna Hussie Banned

    what is the difference between private int and final int in java scripting?
     
  2. aruna29

    aruna29 Banned

    Private int is related to the scope of the variable. Private means the variable is only accessible from within the class, alternatives are public and protected.
    Final means that once the variable is assigned the value cannot be changed. This can help the compiler as it can make certain assumptions of the value. This has nothing to do with where the value can be accessed from.
     
  3. alice789

    alice789 New Member

    They are used for different things. Private is related to the scope of the variable. Private means the variable is only accessible from within the class, alternatives are public and protected.
    Final means that once the variable is assigned the value cannot be changed. This can help the compiler as it can make certain assumptions of the value. This has nothing to do with where the value can be accessed from.