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
Sunny_sXe [5.5K]
2 years ago
14

Pass the two arrays to a method that will display the integer value(s), if any, that appear in both arrays (note that the two ar

rays can have no stored values in common). Save the file as ArrayMethodDemo.java.
Computers and Technology
1 answer:
vampirchik [111]2 years ago
5 0

Answer:

The solution code is written in Java

  1.    public static void checkCommonValues(int arr1[], int arr2[]){
  2.        if(arr1.length < arr2.length){
  3.            for(int i = 0; i < arr1.length; i++){
  4.                for(int j = 0; j < arr2.length; j++){
  5.                    if(arr1[i] == arr2[j]){
  6.                        System.out.print(arr1[i] + " ");
  7.                    }
  8.                }
  9.            }
  10.        }
  11.        else{
  12.            for(int i = 0; i < arr2.length; i++){
  13.                for(int j = 0; j < arr1.length; j++){
  14.                    if(arr2[i] == arr1[j]){
  15.                        System.out.print(arr2[i] + " ");
  16.                    }
  17.                }
  18.            }
  19.        }
  20.    }

Explanation:

The key idea of this method is to repeated get a value from the shorter array to check against the all the values from a longer array. If any comparison result in True, the program shall display the integer.

Based on this idea, an if-else condition is defined (Line 2). Outer loop will traverse through the shorter array (Line 3, 12) and the inner loop will traverse the longer array (Line 4, 13). Within the inner loop, there is another if condition to check if the current value is equal to any value in the longer array, if so, print the common value (Line 5-7, 14-16).

You might be interested in
Which file extension indicates a text document? .ppt .tst .pdf .txt
Ber [7]

Answer:

The answer is .txt

Explanation:

6 0
2 years ago
Read 2 more answers
After class, Anita and Bev make plans to study for their psychology exam together but cannot decide on a time or location. In ad
Paladinen [302]

Answer:

Option B; 30 SECONDS OR LESS.

Explanation:

Short-term memory, also known as primary or active memory, is the information we are currently aware of or thinking about.

When short-term memories are not rehearsed or actively maintained, they last mere seconds.

Most of the information kept in short-term memory will be stored for less than 30 seconds (approximately 20 to 30 seconds), but it can be just seconds if rehearsal or active maintenance of the information is not done.

Therefore, Anita likely will be able to retain the information in short-term memory, without additional processing, for 30 SECONDS OR LESS.

8 0
3 years ago
Which is an acceptable practice when a photographer shoots in windy conditions?
VARVARA [1.3K]

Answer:

d) attach a bag of weights to the tripod

Explanation:

5 0
3 years ago
Write a function that receives a StaticArray where the elements are already in sorted order, and returns a new StaticArray with
Allisa [31]

The code that remove duplicate is as follows:

def remove_duplicate(mylist):

    mylist = list(dict.fromkeys(mylist))

    return mylist

print(remove_duplicate([1, 1, 2, 3, 3, 5, 6, 7]))

<h3>Code explanation</h3>

The code is written in python.

  • we defined a function named "remove_duplicate" and it accept the parameter "mylist".
  • The variable "mylist" is used to store the new value after the duplicate vallues has been removed.
  • Then, wed returned mylist.
  • Finally, we call the function with the print statement . The function takes the required parameter.

learn more on python here: brainly.com/question/21126936

7 0
2 years ago
What does gif stand for in computer terms?
SSSSS [86.1K]
<span>GIF stands for Graphics Interchange Format</span> which was released by CompuServe in 1987. The Graphics in GIF is why some people argue against it's originally intended pronunciation as "jif" (like the peanut butter) 
4 0
3 years ago
Other questions:
  • What does limited access to a document mean?
    14·2 answers
  • If johnny has 800 socks and john has 1000 more how much does john have
    9·1 answer
  • You're programming an infinite loop. What must you include in your code to prevent crashes?
    15·2 answers
  • Question 4 of 20
    5·1 answer
  • What should be used to keep a tablet dry?
    13·1 answer
  • In what other game can kids line up in a row
    6·1 answer
  • Mark is flying to Atlanta. The flight is completely full with 200 passengers. Mark notices he dropped his ticket while grabbing
    15·1 answer
  • please help no one is helping me on this one
    9·1 answer
  • What is the main difference between a peripheral device and other types of devices? Choose the best answer.
    12·1 answer
  • Sub to the channel plz plz
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!