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
Nuetrik [128]
3 years ago
14

Write a static method named contains that accepts two arrays of integers a1 and a2 as

Computers and Technology
1 answer:
pashok25 [27]3 years ago
5 0

Answer:

Sew explaination foe code

Explanation:

import java.lang.*;

import java.util.*;

import java.io.*;

class Main

{

public static Boolean checkSubset(int[] list1, int[] list2)

{

int l = list2.length;

for(int i = 0; i<list1.length-l; i++)

{

Boolean flag = true;

for(int j = 0; j<list2.length; j++)

{

if(list1[i+j] != list2[j])

{

flag = false;

break;

}

}

if(flag) return true;

}

return false;

}

public static void main(String args[])

{

int[] l1 = {1,6,2,1,4,1,2,1,8};

int[] l2 = {1,2,2};

System.out.println(checkSubset(l1,l2));

}

}

You might be interested in
The set of folders and subfolders that MATLAB searches through to locate a command or M-file is called the ___________.(fill in
Oduvanchick [21]

Answer:

<u>path</u>

Explanation:

The sub-folders and folders set that MATLAB searches through in order to locate M-file or a command is known as the path.

These files are stored in the user path which is stored in the user path directory in it.

We usually run the function , i.e., user path function in order to know the location of the folder stored or command or the M-file.

7 0
3 years ago
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
3 years ago
The collaborative team responsible for creating a film is in the process of creating advertisements for it and of figuring out h
miskamm [114]

Answer:

1. distribution

Explanation:

Filmmaking can be defined as the art or process of directing and producing a movie for viewing in cinemas or television. The process of making a movie comprises of five (5) distinct phases and these are;

1. Development.

2. Pre-production.

3. Production.

4. Post-production.

5. Distribution.  

In this scenario, the collaborative team responsible for creating a film is in the process of creating advertisements for it and of figuring out how to generate excitement about the film.

<em>Hence, they are likely in the distribution phase of the five phases of filmmaking.</em>

Distribution refers to the last phase of filmmaking and it is the stage where the collaborative team considers a return on investment by creating advertisements in order to have a wider outreach or audience.

6 0
3 years ago
A third party intercepting a packet and downloading its information before it is sent onward toward its destination is called
SSSSS [86.1K]

Answer:

Explanation:

<u>Packet sniffing</u> is the process of capturing each packet that is transmitted over the network and analyzing its content. Most of the time, packet sniffing is used to troubleshoot network problems or to gather network statistics. The software or device used for capturing packet data is called packet sniffer, packet analyzer, network sniffer or simply network analyzer.

The Packet Sniffer Sensor monitors, among other things:

• Total traffic

• Port sniffer

• Web traffic (HTTP, HTTPS)

• Mail traffic (IMAP, POP3, SMTP)

• File transfer traffic (FTP, P2P)

• Infrastructure traffic (DHCP, DNS, ICMP, SNMP)

• Remote control (RDP, SSH, VNC)

• Other UDP and TCP traffic

Third party intercepting a packet and downloading it information before it is sent onward toward its destination is called <u>Packet Sniffer</u>

4 0
3 years ago
Which of the below statements describes the nature of HTML elements - check as many as apply
slava [35]

Answer:

The answer to this question is option 1,2 and 4.

Explanation:

Some html elements does not contain anything or having no content are called empty html elements.for ex:- <br>,<hr> etc.

HTML elements are of two types block and inline.block elements starts with new line for ex:-div,body etc.Inline elements does not starts with new line.for ex:-<style>,<meta>,<head>etc.

Html elements also contains attributes that modify the element for ex:-

<body style="background-color:blue;">

where style is an attribute.

5 0
3 years ago
Other questions:
  • Refer to the exhibit. A network administrator configures a named ACL on the router. Why is there no output displayed when the sh
    7·1 answer
  • If you had a chance to see what your life would be like in 20 years
    8·1 answer
  • How can a user begin working with a new, blank workbook in Excel?
    10·1 answer
  • Intro to Computers quiz answers me need for test please help me hurry
    5·1 answer
  • An engineer's desktop PC connects to a switch at the main site. A router at the main site connects to each branch office through
    5·1 answer
  • Se citește un număr natural n cu cel mult 16 cifre. Fie q numărul de cifre ale numărului n. Prin eliminarea unei singure cifre d
    5·1 answer
  • Consider this program: Cost1 = input("Please enter the first expense: ") Cost2 = input("Please enter the second expense: ") prin
    6·1 answer
  • Why does dew form on grass overnight
    7·1 answer
  • The following are part of characteristics of a software requirement specification.
    6·1 answer
  • Need answer ASAP!!!!
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!