How to initialise an array in Java

In this post we will provide a few examples on how to initialise an array in Java.

Single dimensional array:

Below are some examples on how to initialise a single dimensional array including initialise an array in one line.

Multi dimensional array:

Below are some examples on how to initialise a multi dimensional array

I hope the above examples has helped you understand how to create an array.

Similar posts:

  1. Java String basics
  2. How to sort a Map
  3. How to sort an Array
  4. Convert String to Integer

 

Leave a Reply