Which of the following is the correct way to declare an array in Java?

Last Updated :
Discuss
Comments

Which of the following is the correct way to declare an array in Java?


int arr[5];

int arr = new int(5);

int[] arr = new int[5];

array<int> arr = new int[5];

Share your thoughts in the comments