- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I concatenate two arrays in java
Following program shows how to concatenate two arrays.
Example
public class Tester { public static void main(String[] args) { int[] a = {1,2,3}; int[] b = {4,5}; int mergeSize = a.length + b.length; int[] c = new int[mergeSize]; int i =0; while(i < a.length) { c[i] = a[i]; i++; } i = 0; while(i < b.length) { c[i + a.length] = b[i]; i++; } i = 0; while(i < c.length) { System.out.println(c[i]); i++; } } }
- Related Articles
- How to concatenate two arrays in java?
- Java Program to Concatenate Two Arrays
- How to concatenate Two Arrays in C#?
- How do I concatenate or Merge Arrays in Swift?
- How can we merge two JSON arrays in Java?
- The easiest way to concatenate two arrays in PHP?
- How can I put a Java arrays inside an array?
- How to concatenate two strings using Java?
- How can we concatenate two strings using jQuery?
- How can I concatenate str and int objects in Python?
- In how many ways we can concatenate Strings in Java?
- How to compare two arrays in Java?
- How can I concatenate an array of integer in MongoDB aggregation method?
- How do we compare two arrays in Java?
- How can I generate two separate outputs using Random in Java

Advertisements