Java final variables changes at the execution time
<p>I don't know the reason fo that. Maybe you could help me</p>

<p>So code here creating a frame with 8 sliders.</p>

<pre><code>public class MyFrame extends JFrame {


ImagePanel imagePanel;
final int Minimum = 0;
final int Maximum = 10;
final int NumberOfSpheres = 8;
final int NumberOfScales = 10;
MyRandomAccessFile file;

final String[] s = {"Друзья и Окружение",
        "Отношения", "Карьера и Бизнес",
        "Финансы", "Духовность и Творчество",
        "Личностный Рост", "Яркость Жизни", "Здоровье и Спорт"};

private final Color[] colors = {Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.BLUE, Color.PINK, Color.MAGENTA, Color.DARK_GRAY};

private final int[] array = {1, 0, 0, 0, 0, 0, 0, 0};

public MyFrame () {

    setTitle("Wheel Of Life");

    MySlider[] sliders = new MySlider[NumberOfSpheres];
    JButton saveButton = new JButton("Save");
    MyActionListener listener1 = new MyActionListener();
    saveButton.addActionListener(listener1);

    file = new MyRandomAccessFile();

    //String s3 = "0 0 0 0 0 0 0 0";
    //array = stringToIntArray(s3);
    array[1] = 4;

    JLabel[] labels = new JLabel[NumberOfSpheres];
    imagePanel = new ImagePanel(colors, array);
    System.out.println(array[1]);
    JPanel mainPanel = new JPanel();
    JPanel[] sliderPanels = new JPanel[NumberOfSpheres];
    JPanel mainSliderPanel = new JPanel(new GridLayout(4, 2, 20, 20));
    MyChangeListener listener = new MyChangeListener();

    for (int i = 0; i &lt; NumberOfSpheres; i++) {
        sliders[i] = new MySlider(s[i]);
        sliders[i].addChangeListener(listener);
        labels[i] = new JLabel(s[i]);
        labels[i].setForeground(colors[i]);
        labels[i].setFont(new Font("Droid Sans", Font.BOLD, 20));
        sliderPanels[i] = new JPanel();
        sliders[i].setMinimum(Minimum);
        sliders[i].setMaximum(Maximum);
        System.out.print(array[i]);
        sliders[i].setValue(4);
        sliders[i].setMajorTickSpacing(1);
        sliders[i].setMinorTickSpacing((int) 0.1);
        sliders[i].setPaintLabels(true);
        sliders[i].setPaintTicks(true);
        sliderPanels[i].setLayout(new GridLayout(2, 1, 5, 5));
        sliderPanels[i].add(sliders[i]);
        sliderPanels[i].add(labels[i]);
        mainSliderPanel.add(sliderPanels[i]);

    }

    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(imagePanel, BorderLayout.CENTER);
    mainPanel.add(mainSliderPanel, BorderLayout.EAST);
    mainPanel.add(saveButton, BorderLayout.SOUTH);

    add(mainPanel);
}
</code></pre>

<p>And the output is this</p>

<p>4
99999999</p>

<p>How can final variable change its value at the execution time, what the hell???
Actual value of variable is depend on value that I writing at sliders[i].setValue(4); But I don't know how exactly...</p>

<p>And I tried to set a watchpoint for this variable... Doesn't working. One time its zero and next time program stop in this for loop value is 9, 4 or whatever...</p>
