Write a program to merge( two) Array.
public class MergeArray {
public static void main(String[] args) {
int array1[]={5,6,7};
int array2[]={8,9,10,11};
int array1_length=array1.length;
int array2_length=array2.length;
int add=array1_length+array2_length;
int sum[]=new int[add];
for (int i=0;i<array1_length;i++)
{
sum[i]=array1[i];
}
for (int i=0;i<array2_length;i++)
{
sum[array1.length+i]=array2[i];
}
for (int i=0;i<sum.length;i++){
System.out.print(sum[i]+" ");
}
}
}
Array List and Array Class in Collection
public class MergeArray {
public static void main(String[] args) {
int array1[]={5,6,7};
int array2[]={8,9,10,11};
int array1_length=array1.length;
int array2_length=array2.length;
int add=array1_length+array2_length;
int sum[]=new int[add];
for (int i=0;i<array1_length;i++)
{
sum[i]=array1[i];
}
for (int i=0;i<array2_length;i++)
{
sum[array1.length+i]=array2[i];
}
for (int i=0;i<sum.length;i++){
System.out.print(sum[i]+" ");
}
}
}
Array List and Array Class in Collection
Sorting and Searching Programs
Start with your Choice
-Important
Programs for Freshers
- Palindrome Number
- Prime
Number
- Swapping
Number
- Leap Year
- Odd and
Even Number
- Fibonacci
Series
- Armstrong
Number
- Factorial
Number
- Print
Table
Learn Pattern Programs
- Alphabet
pattern program in java
- Star
Pattern Programs in Java
- Square
pattern programs in java
- Diamond
Star pattern programs in java
- Number
Pattern Programs in java
- Diagonal
pattern program in java
Click to learn Array Programs
- 4 ways to
print Array in Java
- 2-D Array
in Java
- Anonymous
Array in Java
- Single
Dimensional Array in Java
- Find
Second Largest Number in Array
- Delete an
Element in Array in Java
- Common
Element in Array in Java
- Missing
Element in Array
- Insert
Element in Array
- Reverse
Array in Java
- Merge
Two Array in Java
- Smallest
and Largest Elements in Array
- Find Odd
and Even Number in Array
Click to Learn MySQL
Learn with us | HTML | CSS | JS | Bootstrap | JAVA | ADV JAVA |
MySQL | GIT
1 comment:
Luckyland Hotel & Casino - Mapyro
The 안성 출장안마 Luckyland Hotel & Casino 안산 출장마사지 is located in the picturesque 전라남도 출장마사지 East Coast and provides a 용인 출장안마 casino and entertainment venue. The casino 서산 출장마사지 is owned by Sycuan Tribe of Indians
Post a Comment