menu
Qamnty
Login
Register
My account
Edit my Profile
Private messages
My favorites
Assume the method dosomething has been defined as follows: public static void dosomething (int[] values, int p1, int p2) { int temp = values[p1]; values[p1] = values[p2]; values…
Ask a Question
Questions
Unanswered
Tags
Ask a Question
Assume the method dosomething has been defined as follows: public static void dosomething (int[] values, int p1, int p2) { int temp = values[p1]; values[p1] = values[p2]; values…
asked
Apr 4, 2019
118k
views
2
votes
Assume the method dosomething has been defined as follows: public static void dosomething (int[] values, int p1, int p2) { int temp = values[p1]; values[p1] = values[p2]; values[p2] = temp; } what does the method do?3
Mathematics
college
Zinking
asked
by
Zinking
8.6k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
4
votes
First step is to analyze input and output variables:INPUT:list of integers with name "values"integer with name "p1"integer with name "p2"OUTPUT:there is no output variable as in declaration of a method there is void
ANALYSIS:"int temp = values[p1]"this line creates variable "temp" which is integer. then this line goes to the list "values" and takes value that is at position "p1" and stores it into variable "temp"
"values[p1] = values[p2]"this line goes to the list "values" and takes value that is at position "p2" and stores it into variable that is at position "p1"
"values[p2] = temp"this line takes value of the variable "temp" and stores it into list values at position "p2"
Short explanation:this code replaces values of the list at between positions p1 and p2
Tyler Dane
answered
Apr 9, 2019
by
Tyler Dane
7.9k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
← Prev Question
Next Question →
Related questions
asked
Mar 22, 2019
63.8k
views
Assume the method dosomething has been defined as follows: public static void dosomething (int[] values, int p1, int p2) { int temp = values[p1]; values[p1] = values[p2]; values[p2] = temp; } what does
Sam Dozor
asked
Mar 22, 2019
by
Sam Dozor
8.4k
points
Mathematics
college
1
answer
1
vote
63.8k
views
asked
Oct 6, 2020
209k
views
Assume the method doSomething has been defined as follows: public static void doSomething (int[] values, int p1, int p2) { int temp = values[p1]; values[p1] = values[p2]; values[p2] = temp; } What does
Atanu Mondal
asked
Oct 6, 2020
by
Atanu Mondal
7.7k
points
Computers & Tech
high-school
1
answer
3
votes
209k
views
asked
Mar 9, 2021
94.7k
views
Public static String doSomething(String s) { final String BLANK = " "; //BLANK contains a single space String str = ""; //empty string String temp; for (int i = 0; i < s.length(); i++) { temp = s.substring(i, i + 1); if (!(temp.equals(BLANK))) str += temp; } return str; } Which of the following is themost precise description ofwhat doSomething does? A. It returns a String that contains s.length() blanks. B. It returns s with all its blanks removed. C. It returns s unchanged. D. It returns a String that is equivalent to s with all its blanks removed. E. It returns a String that is an exact copy of s.
Cluster
asked
Mar 9, 2021
by
Cluster
7.8k
points
Computers & Tech
college
1
answer
4
votes
94.7k
views
Ask a Question
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.
Categories
All categories
Mathematics
(3.7m)
History
(955k)
English
(903k)
Biology
(716k)
Chemistry
(440k)
Physics
(405k)
Social Studies
(564k)
Advanced Placement
(27.5k)
SAT
(19.1k)
Geography
(146k)
Health
(283k)
Arts
(107k)
Business
(468k)
Computers & Tech
(195k)
French
(33.9k)
German
(4.9k)
Spanish
(174k)
Medicine
(125k)
Law
(53.4k)
Engineering
(74.2k)
Other Questions
How do you can you solve this problem 37 + y = 87; y =
What is .725 as a fraction
A bathtub is being filled with water. After 3 minutes 4/5 of the tub is full. Assuming the rate is constant, how much longer will it take to fill the tub?
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search Qamnty