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
kifflom [539]
3 years ago
9

Consider the code block below. What is the value of amount when this method is called twice, the first time using cookieJar(7) a

nd then using cookieJar(22)?
public static int cookieJar(int addCookies) {

int amount = 0;
amount += addCookies;
return amount;
}

a. 7
b. 15
c. 22
d. 29
e. An error occurs
Computers and Technology
1 answer:
Alex787 [66]3 years ago
4 0

Answer: 29

Explanation:

The variable amount is given a initial value of 0

Therefore, the first method call:

cookieJar(7)

amount + cookieJar

amount = 0 + 7 = 7

And the value of 7 is returned for amount at the start of the block

Thus, when cookieJar is called the second time ;

cookieJar(22)

amount + cookieJar

amount = 7 + 22 = 29

And the value of 29 is returned for amount at the start of the block

You might be interested in
The Learning Journal is a tool for self-reflection on the learning process. The Learning Journal will be assessed by your instru
eimsori [14]
Any song recommendations u got for me? Thanks for the points!!!!
5 0
3 years ago
What do you call the number that is used as an index to pinpoint a specific element within an array?
Pie

Answer:

d. subscript

Explanation:

Although I believe "index" is a better term. The question already says it!

5 0
4 years ago
Computer Hardware and Maintenance
Gnesinka [82]

Answer:

All of these answers

Explanation:

8 0
3 years ago
Why does space exploration lead to new technology?
valentina_108 [34]

Answer:

C. Because materials developed for use in space are often useful to ordinary citizens.

Explanation:

A, is not correct due to the "only" word. Humans can explore space too.

B, not that either because you will need lots of technology to space travel, not less.

C, because materials that can be produced through scientists' ideas can help contribute to society and improve technology.

D, is not correct because there is no need for new materials for new technology.

5 0
3 years ago
During which phase of a hacker's five-step approach does the hacker scan a network to identify IP hosts, open ports, and service
bekas [8.4K]

Answer: Reconnaissance

Explanation:Reconnaissance is referred as the initial/primary phase in which the attacker/ hacker puts the every effort to gain the knowledge about the target that is collecting facts about the DNS data, network records, IP address, range of IP etc.

It is the initial step done by the attackers to do the preparation of the hacking.It is done by the two phases that is active phase and the passive phase.

3 0
4 years ago
Other questions:
  • Which computer tools allow you to communicate with coworkers, family,and friends
    8·1 answer
  • Introduction to graphic design please help! Define the four terms: design ,art,decoration , and visual literacy. Describe how th
    12·1 answer
  • Which is an example of an active visual interface? a display indicating the amount of ammunition for the currently equipped weap
    13·2 answers
  • What is a many-to many types of correspondence?
    5·1 answer
  • Which of these statements describes the difference between binary and decimal numbers?
    11·2 answers
  • Which country began expanding its borders with exploration in the late 16th<br>century?​
    15·1 answer
  • Selena needs to insert a comment in a webpage's code to ensure that other web team members who work with the page code understan
    15·1 answer
  • Devon keeps his commitments, submits work when it's due, and shows up when scheduled. What personal skill does Devon
    15·2 answers
  • If you said the bottom margin, you are talking about what?
    13·2 answers
  • Write the following abbreviations in full next to the question number
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!