1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
adoni [48]
3 years ago
5

Consider the program below: public class Test { public static void main( String[] args ) { int[] a; a = new int[ 10 ]; for ( int

i = 0; i < a.length; i++ ) a[ i ] = i + 2; int result = 0; for ( int i = 0; i < a.length; i++ ) result += a[ i ]; System.out.printf( "Result is: %d\n", result ); } // end main } // end class Test The output of this program will be:
Computers and Technology
1 answer:
Anna11 [10]3 years ago
3 0

Answer:

Result is: 65

Explanation:

To analyze this code let us asign line numbers:

  1. public class Test {
  2.    public static void main( String[] args )
  3.    { int[] a; a = new int[ 10 ];
  4.        for ( int i = 0; i < a.length; i++ )
  5.            a[ i ] = i + 2;
  6.        int result = 0;
  7.        for ( int i = 0; i < a.length; i++ )
  8.            result += a[ i ];
  9.        System.out.printf( "Result is: %d\n", result );
  10.    }
  11. }

On line 3, an array of ints is created of size 10

On line 4 and 5 a for loop is used to add values to the array. at the end of the execution of line 4 and 5, the array will contain the following elements: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

On line 6 an int variable result is created and initialized to 0

line 7 and 8 allows a for loop through the array adding up all the elements of the array and assigning them to result

Line 9 outputs the value of result (Which is the total sum)

You might be interested in
What advantage do ExpressCard modules and U.S.B adapters offer over expansion cards?
sladkih [1.3K]
The advantage does of ExpressCard modules and U.S.B adapters offer over expansion cards is that it can connect a variety of devices to a computer. The technical standard of ExpressCard specifies the design of slots built into the computer and of expansion of cards to insert in the slots including the mobile broadband modems. It is sometimes connectors for externals devices such as flash drives, USB connectors and other ports that need to connect to the computer.
4 0
3 years ago
What are the applications of computer in the field of study​
Reptile [31]

Answer: it is what it is

Explanation:

5 0
2 years ago
Read 2 more answers
Which service uses a broadband connection?
Sidana [21]

Answer:

d

Explanation:

because all in one question form

5 0
3 years ago
For all of you who listen to podcasts, when do you usually find time to do so?​
ss7ja [257]
Morning and afternoon commute times are obvious blocks of time that you can assume are used for listening to podcasts, but the answer will obviously vary widely based on individual habits and schedules.

Hope this helps
7 0
2 years ago
.حدد/ي الكيانات في النظام
olasank [31]

Answer:

what

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • Tower defense is included under which genre of game
    15·2 answers
  • To use the program service routines, the user's program makes requests to the operating system through the
    10·1 answer
  • What was the major sign that lead Professor Shiller to predict the crash of the housing market​
    6·1 answer
  • Number 20, can anyone help?
    11·1 answer
  • What is an advantage of a computer network ? networked
    13·2 answers
  • What is the term for a Web site that allows users to access and interact with software from any Internet-connected computer or d
    11·1 answer
  • In a systems development life cycle (SDLC) model, the purpose of the _____ is to create a physical model that will satisfy all d
    10·1 answer
  • What does good time management mean​
    8·2 answers
  • ¿Cuál es la función que cumplía los sofistas y Porque eran tan importantes?​
    13·1 answer
  • as a pc technician, you are on the road most of the day and use a laptop. when you get back to your office at the end of the day
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!