You haven't declared
at all, you have two different declarations of
in the same scope:
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
for (int i = 0; i < a.length; i++)
You bubble sort some values, then overwrite them all again ...
That looks like it was thrown together without any significant thinking about what you expected to produce.
Stop and think about what you are doing before you start coding: it will save you a lot of time in the long run! This may help you: How to Write Code to Solve a Problem, A Beginner's Guide