Results 1 to 4 of 4

Thread: Final arrays

  1. #1
    La VloZ is offline Member
    Join Date
    Jul 2013
    Posts
    5
    Rep Power
    0

    Question Final arrays

    Hello all
    I want to create a final array with final elements

    Java Code:
    final int[] array = {0, 1, 2, 3, 4, 5};
    But here only the reference of the array is final , not it's elements
    So how can i do that??
    Thank u all

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,574
    Blog Entries
    7
    Rep Power
    21

    Default Re: Final arrays

    Don't use an array but an unodifiable list (see the Collections class how to get one).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Final arrays


  4. #4
    La VloZ is offline Member
    Join Date
    Jul 2013
    Posts
    5
    Rep Power
    0

Similar Threads

  1. Copying Single Arrays to 2-D Arrays
    By jmscarlet9 in forum New To Java
    Replies: 7
    Last Post: 04-02-2012, 11:17 PM
  2. Arrays + Final = Trouble
    By Bgreen7887 in forum New To Java
    Replies: 8
    Last Post: 11-30-2010, 11:23 PM
  3. Arrays.sort... why sorting all arrays in class?
    By innspiron in forum New To Java
    Replies: 6
    Last Post: 03-23-2010, 01:40 AM
  4. [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
  5. Poi 3.0-final
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-22-2007, 07:05 AM

Tags for this Thread

Posting Permissions

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