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]
3 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]3 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
In order for bitlocker to protect the system volume without the aid of an external drive, your computer must:
zhenek [66]
70% C, 20% B, 5% / 5% - A /B
4 0
3 years ago
Read 2 more answers
Both IT professionals and governments must apply ethical principles to certify that emerging technologies are to society.
Katarina [22]
The answer is C fair………………………
6 0
2 years ago
Use the drop-down menus to complete the steps to share a presentation through OneDrive.
charle [14.2K]

Answer:

Share

OneDrive

In real time

Send

Explanation:

5 0
3 years ago
Describe how implementation of a raid level 2 system would be beneficial to a university payroll system
lisabon 2012 [21]

<span>The RAID level 2 could give high information exchange rates and would be straightforward contrasted with other Raid levels. Be that as it may, it has a high cost and would need a high rate move required with a specific end goal to legitimize this cost.</span>

4 0
4 years ago
Which of these agents of education empowers the other..........
Tomtit [17]

Answer:

B. school

Explanation:

Because the school is where you learn and gain knowledge

4 0
2 years ago
Read 2 more answers
Other questions:
  • A file that contains program code is called a ____________.
    13·1 answer
  • _____ software can help a company manage security, enforce corporate strategies, and control downloads and content streaming fro
    11·1 answer
  • What color does Sam obtain when he mixes white with a color? Sam is painting a landscape and needs to paint the sky light blue.
    9·2 answers
  • (Please answer! Correct answer gets brainliest!)
    5·2 answers
  • Should the federal government have bug bounty programs? Why or why not?
    9·2 answers
  • A network systems administrator would most likely help with
    13·2 answers
  • Which of the following will increase the level of security for personal and confidential information on a mobile device if the d
    14·1 answer
  • Write a method named isNumericPalindrome that accepts an integer parameter named num. If num is a palindrome the method must ret
    6·1 answer
  • Which of the following variable names follows the rules for naming variables?
    13·1 answer
  • What does the top level domain in a url inducate? A. The organization or company that owns the website. B. The organization or c
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!