Is using `int` more preferable than using `unsigned int`?

Could someone show me a code demo of a 1D array that has fixed int's and is then stored in a result using a loop?

  • I have this int[] anArray = { 1,2,3,4,5,6,7,8,9};         int total = 0;         for(int x = 0; x < anArray.length; x++){         total += anArray[x];         }         System.out.println(anArray[total]); It compiles, but does run. I just want it to print the numbers in my array, using a loop. Suggestions?

  • Answer:

    Well if you want to print the numbers in the array you must do System.out.println(anArray[x]) each time, and if you want to print the total sum then you must print System.out.println(total).

Julián Solórzano at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.