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
_____ regulate current/voltage flow, similar function as _____,but are smaller, cheaper, and more reliable.
Tpy6a [65]

Direct Current Power regulates current/voltage flow, similar function as unregulated or regulated, but is smaller, cheaper, and more reliable.

<h3>What is Direct Current Power?</h3>
  • In contrast to the flow of a river, direct current is a technique in which electricity constantly flows in the same direction. It speaks about the flow of electricity produced by batteries, solar cells, and other sources.
  • Alternating current (AC), on the other hand, is a technique in which the positive and negative sides are consistently swapped at regular intervals, changing the direction of the electricity flow in accordance.
  • This is the electricity that comes from a generator or a plug-in.
  • Alternating current is used to transmit both the electricity generated at power plants and the electricity delivered to houses.

To learn more about Direct Current Power, refer:

brainly.com/question/1402412

#SPJ4

8 0
2 years ago
How does the game Clash Royale keep players continuously active and engaged?
lana [24]

Answer: a

Explanation: because they have to beat and check the players to move on

4 0
3 years ago
Define a class named person that contains two instance variables of type string that stores the first name and last name of a pe
Katarina [22]

Answer:

Answered below

Explanation:

//Program is written using Java programming language.

Class Person {

private string firstName;

private string lastName;

void set firstName(string a){

firstName = a;

}

string getFirstName(){

return firstName;

}

void setLastname( string b){

lastName = b;

}

string getLastName( ){

return lastName;

}

void displayDetails( ) {

System.out.print(firstName);

System.out.print (lastName);

}

}

//Test program

Class Main{

public static void main(String args [] ){

Person person = new Person( )

person.setFirstName("Karen")

System.out.print(person.getFirstName)

person.displayDetails()

}

}

5 0
3 years ago
Which method below will allow you to rearrange the order of your slides to ensure the overall flow of your presentation makes se
omeli [17]
Um... there are no methods on this page, but my guess is... order of importance?   
4 0
2 years ago
ASAP!
Alona [7]
<h2>Answer:</h2>

In Digital Photography ISO is the sensitivity level of the image sensor. So if the camera has lower ISO number/value it means that camera is less sensitive to light and its image sensor is not much sensitive.

On the other hand, Higher numbers of ISO mean the sensor of camera is more sensitive to light which will let you use your camera in darker situations as given in the question. Here is an example where you want to fix the camera on a higher ISO is whenever there is less light like in an indoor event or dark location where light is not much. By choosing a higher ISO the shutter speed will get faster and you will be able to freeze the movement and you can get better image.

<h3>I hope it will help you!</h3>
8 0
3 years ago
Read 2 more answers
Other questions:
  • In programming, what is a floating-point number?<br>​
    7·1 answer
  • 1. Potential incidents represent threats that have yet to happen. Why is the identification of the threat important to maintaini
    6·1 answer
  • State three differences between a hard drive and a pen drive​
    6·1 answer
  • You can install several printers on your machine, but at least one must be the _______ printer.
    6·1 answer
  • Write a function named firstLast2 that takes as input an array of integers and an integer that specifies how many entries are in
    14·1 answer
  • Www.microsoft.com is an example of this (two words) (last letter is e) and has to be (10 letters)
    10·1 answer
  • For each of the users of accounting information, identify whether the user is an external decision maker (E) or an internal deci
    6·1 answer
  • Is it safe to turn on a computer without ram?
    5·2 answers
  • 1. Why do you need to take care of your computer? (Remember: Answer must include 3-5 sentences.)
    13·1 answer
  • 2. As you have learned, ironically, a large part of sound production involves visual perception. How easy or difficult did you f
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!