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
makvit [3.9K]
3 years ago
15

Implement a recursive java method to find the sum of the first n int's in a java int array. Max size 20.

Computers and Technology
1 answer:
oee [108]3 years ago
6 0

Solution:

public class SumOfArray {

private int[] a;

private int n;

private int result;

   public int sumOfArray(int[] a,int n) {

     this.a = a;//Max size is 20

     n = a.length;

     if (n == 0)  // base case

     return a[n];

     else

         return a[n] + sumOfArray(a, n-1);

     return result;

  } // End SumOfArray method

} // End SumOfArray Class  


You might be interested in
All who are interested in forex trading and bitcoin mining follow me for account management to all who are busy with work so i c
masya89 [10]

I am very interested but too young just 10

8 0
3 years ago
Uses of keyboard as a input device
KATRIN_1 [288]

helps us for typing letters, numbers and symbols etc.

3 0
3 years ago
Read 2 more answers
The physical parts of the computer that you can see and touch are called______.
Tatiana [17]
Physical parts of computer: Computer Hardware
5 0
3 years ago
If i find an image and copy and paste it into Paint.
Leokris [45]

Answer:

Lossy image formats will remove data during compression as a trade off for lower storage occupation. Lossless data formats will not remove data during compression, resulting in higher quality but also higher storage occupation.

Graphic Artists will almost always use lossless due to it delivering the highest quality image possible.

8 0
4 years ago
Which of the following is the best description of the [Drive for] block?
Ede4ka [16]
The answer is C to this question
6 0
3 years ago
Other questions:
  • In every organization, workers receive and sendinformation daily. The flow of this information should be____________.upward and
    11·1 answer
  • If you will be giving your presentation to an audience, you can practice your presentation by using View, ___________, to rehear
    14·1 answer
  • Halp Computer Science
    12·2 answers
  • The duties of a database administrator include determining which people have access to what kinds of data in the database; these
    13·2 answers
  • Who is the father of computer?​
    14·1 answer
  • Mingji is working to transfer photos from her digital camera to her computer. While
    11·1 answer
  • Consider the following code segment, which is intended to simulate a random process. The code is intended to set the value of th
    13·1 answer
  • What type of access controls allow the owner of a file to grant other users access to it using an access control list
    5·1 answer
  • In how many positions are there nucleotide differences between your query sequence and the sequence of accession AY259214.1
    12·1 answer
  • From the time users first visit a new website, or view a new media piece, how much time will they spend on the site before they
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!