Consider the following code snippet: String[] data = { "abc", "def", "ghi", "jkl" }; String [] data2; In Java 6 and later, which statement copies the data array to the data2 array?

Answers

Answer 1
Answer:

Answer:

String[] data2 = Arrays.copyOf(data, 4); is the statement which copies the data array to the data2 array in java 6 .

Explanation:

The Arrays.copyOf() function copies the data from first array to another array in java .We pass the two argument in this function  first argument is the name of first array and second the length of first array .

Following are the program in java  

import java.util.Arrays; // import package  

public class Main

{

public static void main(String[] args) // main function

{

String[] data = { "abc", "def", "ghi", "jkl" }; // string declaration

// printing the array data1

 System.out.println("before copy new array:");

 for (int k = 0; k < data.length; k++)  

     {

 System.out.println(data[k]);

 }

String[] data2 = Arrays.copyOf(data, 4);

 // printing the array data2

     System.out.println("after copy new array:");

     for (int k = 0; k < data2.length; k++)  

     {

        System.out.println(data2[k]);

     }}}

Output:

before copy new array:

abc

def

ghi

jkl

after copy new array:

abc

def

ghi

jkl


Related Questions

Matt goes to an Internet café and tries to access his emails. The email client asks Matt to enter his email address along with the password associated with it. By asking for the email address and the password, the email client is _____ Matt. A) authenticating B) authorizing C) decrypting D) acknowledging
Modern ancestor of the typewriter
I want the honest opinions. I'm doing a report for school and I decided to compare five phones. The Iphone 6 PlusThe Samsung Galazy S5LG G3Nokia Lumia 1520Nexus 6If I could get a couple of opinions which one you would choose and why that would be awesome!
Rockstar Software, Inc., develops a new series of performance-related video games. This software is most likely protected by
Create a flowchart that assigns a counselor to a student. You need to ask a student for the first letter of his/her last name. Assign a counselor based on the following criteria:• A through Mare assigned to Ms. Jones • N through Z are assigned to Mr. Sanchez ​

How many generations of computers languages have there been since the middle of the 20th century

Answers

There are 4 computer language generations. First is the first generation language or 1GL, second is the second-generation languages or the 2GL, next is the third-generation languages or the 3GL, and the last is fourth-generation languages or the 4GL.

Answer

There are four generations of computer programming languages(4GLs)But fifth generation is still on development.

Explanation

First generation programming languages(1GL) These are programming languages were used to program the very first computers which are described ts the first generation of computers .They were low level languages.

Second generation programming language (2GL) These were low level assembly languages an example is COBOL.

Third generation programming language (3GL) These are high level programming languages examples are java,c++ e.t.c

Fourth generation programming languages (4GL) These are programming languages which are more user friendly than the other three generations. They are normally used in development of commercial business software and many others

Fifth generation programming language (5GL) these are languages which are now used in problem solving .They are more user friendly and are advanced in technology.This fifth generation is still under development.

Which one these describe the use of the word wall technique?

Answers

A word wall is a technique or a literacy tools mainly used by the students who are creating memorable experiences like in remembering of new words in vocabulary. In schools, word wall is commonly placed on bulletin boards where a collection of words are displays in visible letters.

What is another name for mesolithic age

Answers

 Cretaceous Period or Middle Stone Age, either works
In archaeology, mesolithic is culture between paleolithic and neolithic. The term "Epipaleolithic" is often used for areas outside northern Europe, but was also the preferred synonym used by French archaeologists until the 1960s.

Do debit cards allow you to draw funds directly from your checking accounts

Answers

some of them do let you draw funds but not all debit cards

Which is the last step in conducting a URL search? A. The user's browser renders the html code as a visual web page.
B. The datacenter routes the request to a destination server which hosts the website.
C. The user types a web address in his or her browser.
D. Request goes through a router or modem to the user's ISP.

Answers

i think the last step in conducting a URL search would be : A. The user's browser renders the html code as a visual web page. A web page that we commonly see is structured by a bunch of 1 and 0. Rendering process allow the machine to interpret that 1 and 0 into the visual that we currently seeing Hope this helps. Let me know if you need additional help!

User’s browser renders HTML code from destination server into web page


Which of the following are considered transactions in an information system?1) money deposited in a bank account
2) student recording her answer to a question in an online test
3) customer adding an item to the online shopping cart

Select one:
a) 1 and 3 only
b) 1 only
c) All of them
d) None of them

Answers

Answer: (C) All of them.

Explanation:

 All the given options are example of the transaction in the information system.

As, the money deposited in the bank account is the process that take place computerized for transaction purpose. Now a days we can easily done transaction through wire transfer at anywhere and anytime by using the information system technology.  

Students can easily study online and also record their answers in the online test by using the information system technology.  

Customers can also doing shopping online by adding various products and items in the online shopping cart by using various e-commerce websites like amazon, flip-cart etc.