In order to declare and initialize array in java, you need to use the following code:Int num[5] = {1,2,3,4,5};Here the “int num[5]” is for declaration and “{1,2,3,4,5}” is the initialization.