8.10: Netbeans

Asked by peter

Hi

I thought the problem has been solved but I was mistaken (I asked this question already in the Netbeans forum, but unfortunately I haven't been getting an answer). I've the following Java code:

int[] anArray = {37, 23, 11, 87, 63, 55, 17, 1, 46, 88};
int temp;
int temp1;
int temp2;

for (int x1 = 0; x1 < anArray.length; x1++) {
     for (int x2 = 1; x2 < anArray.length; x2++) {
           temp1 = anArray[x1]:
            emp2 = anArray[x2]:

             if temp1 > temp2
                  temp = anArray[x1];
                  anArray[x1] = anArray[x2];
                  anArray[x2] = temp;
      }
}

If I run it, I always get the following error message:

run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - variable temp might not have been initialized

        at cobolsortapp.Main.main(Main.java:36)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

If I click "Main.java:36", the cursor will be placed in the line "anArray[x2] = temp".

Can you tell me why I get this error? And what can I do to prevent it? Thanks.
Peter

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
peter
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You'd be better posting on a java forum too. 8.10 is EOL also and no longer supported. 9.04 dies next month too.

Revision history for this message
peter (peter-neuweiler) said :
#2

solved