Tuesday, October 5, 2021

 


Java Program: Take 2 arrays, write a method to - Insert array2 in to array1 at given position

//Output: {12, 13,14,5,6,15}


package qasign;

import java.util.ArrayList;

import java.util.Arrays;

public class SampleTest {

public static void main(String[] args) {

Integer array1[]={12, 13,14,15};

Integer array2[]={5, 6};

int position=3;

List<Integer> list1=new ArrayList<>(Arrays.asList(array1));

System.out.println();

Arrays.asList(array2);

List<Integer> list2=new ArrayList<>(Arrays.asList(array2));

list1.addAll(position, list2);

System.out.println(list1);

}

}

Related Posts:

  • Manual Testing QuestionsWhat is Smoke Testing?Smoke Testing: This is build acceptance Testing performed after build is released to the Testing. This Testing is done to check the major functionalities are working fine or not.What is Sanity Testing?Sa… Read More
  • Quick Notes on Selenium IQsWhat is method overload and method override?Method Overload:method overload means methods contain with same name and difference in the parametersThis difference may be in the  -> sequence of the parameters -> numbe… Read More
  • Java Program to Insert array2 into array1 at given position Java Program: Take 2 arrays, write a method to - Insert array2 in to array1 at given position//Output: {12, 13,14,5,6,15}package qasign;import java.util.ArrayList;import java.util.Arrays;public class SampleTest { public… Read More
  • Write a Java Program to Add Map Elements and Print  package qasignpackage;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Map.Entry;public class SampleTest {    public … Read More
  • Reverse Each Word in a String Input "hello world java"  1) Reverse each word in a string Input: hello world java     //Output: olleh dlrow avaj String str="hello world java"; String[] tokens=str.split(" "); for(int i=0;i<tokens.length;i++) { for(int j=… Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts